Opened 9 years ago

Last modified 7 years ago

#14112 needs_work enhancement

Allow to turn off axes selectively in plot

Reported by: ppurka Owned by: jason, was
Priority: major Milestone: sage-6.4
Component: graphics Keywords:
Cc: kcrisman Merged in:
Authors: Punarbasu Purkayastha Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by ppurka)

There have been a couple of questions regarding more control over the axes in plot. One question asks to be able to selectively turn off y-axis. Some option like this, which extends the axes keyword should do the job quite nicely.

plot(x, axes=[True, False])

Apply to devel/sage: trac_14112-allow_individual_axes.patch

Attachments (1)

trac_14112-allow_individual_axes.patch (4.4 KB) - added by ppurka 9 years ago.
Apply to devel/sage

Download all attachments as: .zip

Change History (14)

Changed 9 years ago by ppurka

Apply to devel/sage

comment:1 Changed 9 years ago by ppurka

  • Authors set to Punarbasu Purkayastha
  • Description modified (diff)
  • Status changed from new to needs_review

Added a patch to introduce the needed functionality. Needs review. :)

comment:2 Changed 9 years ago by kcrisman

  • Cc kcrisman added

comment:3 follow-up: Changed 8 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to needs_work

What do you think that extra

if axes is None

was there for? It seems okay to remove it.

What do you think would happen with

yaxis='right'

instead of 'left' at the end? I'm just curious if it would make a difference. I suppose I could try it out... it doesn't seem to make a difference. Does it need to be set at all? Answering my own question... hmm, I think we need to decide what to do here.

sage: plot(x,(x,-10,-8),axes=[False,True],axes_labels=['x','y'])
sage: plot(x,(x,8,10),axes=[False,True],axes_labels=['x','y'])

Should this be valid? And currently the x-axis in the first one shows up at the bottom, which is wrong (in some sense). Probably it should just be turned off. Putting needs work, but maybe it's closer to needs info. Otherwise I like this.

comment:4 Changed 8 years ago by ppurka

The axes is none was just setting the default if the user did not specify axes.

I don't understand why this is working when the if statement is removed; in fact I don't remember much about this patch. Will need some time to revisit this.

comment:5 in reply to: ↑ 3 Changed 8 years ago by ppurka

Replying to kcrisman:

sage: plot(x,(x,-10,-8),axes=[False,True],axes_labels=['x','y'])
sage: plot(x,(x,8,10),axes=[False,True],axes_labels=['x','y'])

Should this be valid? And currently the x-axis in the first one shows up at the bottom, which is wrong (in some sense). Probably it should just be turned off. Putting needs work, but maybe it's closer to needs info. Otherwise I like this.

I get the x-axis turned off in both the plots. Is that not what you are getting? The x label is still there and the labels don't seem centered any more.

comment:6 follow-up: Changed 8 years ago by kcrisman

The axes is none was just setting the default if the user did not specify axes.

Yeah, but it was there twice.

Is that not what you are getting?

Sorry, that's what I meant - the x label for the axis.

comment:7 in reply to: ↑ 6 Changed 8 years ago by ppurka

Replying to kcrisman:

Sorry, that's what I meant - the x label for the axis.

Sorry, why should the label be removed? Maybe the user actually wants the label. There is always the option of passing axes_labels=['', 'y'] if the user does not want the axis to be labeled either.

comment:8 follow-up: Changed 8 years ago by kcrisman

Well, but where should the labels for the axes be? I suppose you really could have an axis label if you don't have an axis... though it seems weird. It looks like a random floating letter.

comment:9 in reply to: ↑ 8 Changed 8 years ago by ppurka

Replying to kcrisman:

Well, but where should the labels for the axes be? I suppose you really could have an axis label if you don't have an axis... though it seems weird. It looks like a random floating letter.

I don't know if the position of the label can be controlled. It is up to mpl to position it. But, this is really up to the user to decide if (s)he wants the label or not. It does look like an isolated letter, partly because it is a single letter in our examples.

comment:10 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:11 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:12 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:13 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.