|
From: Kevin H. K. <kmh...@nc...> - 2013-04-07 18:26:33
|
Hullo Matplotlib List,
I'm looking for a way to represent on an X-Y graph the fact that an axis
does not start from the origin. When drawing by hand, I'll use a little
zig-zag, lightning bolt, or slight space on the axis in question to
represent this fact, just off from where the X and Y axis lines meet.
How would I go about telling Matplotlib to do this? After two hours of
perusing the Axes documentation, and tooling around in an IPython shell,
I appear to be striking out.
If you are using a monospaced font to view this email, this may
illustrate the functionality for which I'm looking:
150 || * *
145 || * *
140 || * *
135 || *
130 ||
/
/ <---- "zig zag" I want
||
0 --------------------------------
0 1 2 3 4 5 6 7 8
Many thanks for any help,
Kevin
|
|
From: Francesco M. <fra...@gm...> - 2013-04-07 18:34:54
|
2013/4/7 Kevin Hunter Kesling <kmh...@nc...> > Hullo Matplotlib List, > > I'm looking for a way to represent on an X-Y graph the fact that an axis > does not start from the origin. When drawing by hand, I'll use a little > zig-zag, lightning bolt, or slight space on the axis in question to > represent this fact, just off from where the X and Y axis lines meet. > How would I go about telling Matplotlib to do this? After two hours of > perusing the Axes documentation, and tooling around in an IPython shell, > I appear to be striking out. > > If you are using a monospaced font to view this email, this may > illustrate the functionality for which I'm looking: > > > 150 || * * > 145 || * * > 140 || * * > 135 || * > 130 || > / > / <---- "zig zag" I want > || > 0 -------------------------------- > 0 1 2 3 4 5 6 7 8 > > > Many thanks for any help, > > Kevin > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > Hi Kevin, Have you given a look at this example: http://matplotlib.org/examples/pylab_examples/broken_axis.html Francesco |
|
From: Kevin H. K. <kmh...@nc...> - 2013-04-07 19:03:29
|
At 2:34pm -0400 Sun, 07 Apr 2013, Francesco Montesano wrote: > 2013/4/7 Kevin Hunter Kesling >> I'm looking for a way to represent on an X-Y graph the fact that an axis >> does not start from the origin. When drawing by hand, I'll use a little >> zig-zag, lightning bolt, or slight space on the axis in question to >> represent this fact, just off from where the X and Y axis lines meet. >> How would I go about telling Matplotlib to do this? After two hours of >> perusing the Axes documentation, and tooling around in an IPython shell, >> I appear to be striking out. >> >> If you are using a monospaced font to view this email, this may >> illustrate the functionality for which I'm looking: >> >> 150 || * * >> 145 || * * >> 140 || * * >> 135 || * >> 130 || >> / >> / <---- "zig zag" I want >> || >> 0 -------------------------------- >> 0 1 2 3 4 5 6 7 8 > Have you given a look at this example: > http://matplotlib.org/examples/pylab_examples/broken_axis.html Damn, I clearly missed that one. And once I know what I'm looking for, my eye goes right to it. Sorry for the noise. On the other hand, I'm still such a noob at Matplotlib ... is there a way to have one of the subplots take up more than its default 50% allotment? Thanks, Kevin |
|
From: Francesco M. <fra...@gm...> - 2013-04-07 20:21:02
|
Il giorno 07/apr/2013 21:03, "Kevin Hunter Kesling" <kmh...@nc...> ha scritto: > > At 2:34pm -0400 Sun, 07 Apr 2013, Francesco Montesano wrote: >> >> 2013/4/7 Kevin Hunter Kesling >> >>> I'm looking for a way to represent on an X-Y graph the fact that an axis >>> does not start from the origin. When drawing by hand, I'll use a little >>> zig-zag, lightning bolt, or slight space on the axis in question to >>> represent this fact, just off from where the X and Y axis lines meet. >>> How would I go about telling Matplotlib to do this? After two hours of >>> perusing the Axes documentation, and tooling around in an IPython shell, >>> I appear to be striking out. >>> >>> If you are using a monospaced font to view this email, this may >>> illustrate the functionality for which I'm looking: >>> >>> 150 || * * >>> 145 || * * >>> 140 || * * >>> 135 || * >>> 130 || >>> / >>> / <---- "zig zag" I want >>> || >>> 0 -------------------------------- >>> 0 1 2 3 4 5 6 7 8 > > >> Have you given a look at this example: >> http://matplotlib.org/examples/pylab_examples/broken_axis.html > > > Damn, I clearly missed that one. And once I know what I'm looking for, my eye goes right to it. Sorry for the noise. > > On the other hand, I'm still such a noob at Matplotlib ... is there a way to have one of the subplots take up more than its default 50% allotment? > > Thanks, > > Kevin hi Kevin, you can give a look at the last two plots in this example http://matplotlib.org/examples/pylab_examples/demo_tight_layout.html or use plot.axes providing the rectangle that you want fra |
|
From: Kevin H. K. <kmh...@nc...> - 2013-04-08 19:05:12
|
At 4:20pm -0400 Sun, 07 Apr 2013, Francesco Montesano wrote: > Il giorno 07/apr/2013 21:03, Kevin Hunter Kesling ha scritto: >> On the other hand, I'm still such a noob at Matplotlib ... is there >> a way to have one of the subplots take up more than its default 50% >> allotment? > > you can give a look at the last two plots in this example > http://matplotlib.org/examples/pylab_examples/demo_tight_layout.html or use > plot.axes providing the rectangle that you want That is closer to what I want, but still not there. I was finally able to find something that fit the bill to 95% of what I want: http://matplotlib.1069221.n5.nabble.com/Proposal-for-Broken-Axes-td38050.html The first post by 'klukas' does exactly what I asked for. It's a zig-zag on the Y-axis to show that what is graphed is not continuous, and unlike the various "official" examples, the zig-zag placement is user-specifiable, as opposed to exactly halfway between the top and bottom. The only thing I have yet to figure out how to do is to simultaneously have a zig-zag on the X axis as well -- an artifact of how these zig-zags must be created via multiple axes on the same figure, rather than as built in to the axis artist. For googleability: The above linked graph code enables for matplotlib: - suppressed zeros on the Y-axis of an XY plot - showing suppressed data on the Y-axis - lightning bolt symbol on the Y-axis - zig-zag on the Y-axis - a "broken" Y-axis Thanks for your pointers, Francesco, as they helped me to fine-tune my Google search terms. And thank you, Klukas, whoever you are. Cheers, Kevin |
|
From: ChaoYue <cha...@gm...> - 2013-04-08 20:55:43
|
Hi Kevin, I don't check the link you provided very carefully. So I guess you already find a solution. otherwise I have done something similar before and have made a bit general function to do the job, which I think might be helpful for you. You can check the following three functions at https://github.com/ChaoYue/pylsce/blob/master/g.py Calc_Newaxes_Fraction Axes_Replace_Split_Axes Axes_Set_Breakaxis a working example is below: >>> fig,axs = plt.subplots(nrows=2) >>> bottom_ax, top_ax = g.Axes_Replace_Split_Axes(fig,axs[0],split_fraction=[0.36,0.04,0.6],direction='v') >>> g.Axes_Set_Breakaxis(bottom_ax, top_ax, 0.01,0.03,'v') >>> left_ax, right_ax = g.Axes_Replace_Split_Axes(fig,axs[1],split_fraction=[0.38,0.02,0.6],direction='h') >>> g.Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h') the figure is as attached. cheers, chao On Mon, Apr 8, 2013 at 9:05 PM, Kevin Hunter [via matplotlib] < ml-...@n5...> wrote: > At 4:20pm -0400 Sun, 07 Apr 2013, Francesco Montesano wrote: > > Il giorno 07/apr/2013 21:03, Kevin Hunter Kesling ha scritto: > >> On the other hand, I'm still such a noob at Matplotlib ... is there > >> a way to have one of the subplots take up more than its default 50% > >> allotment? > > > > you can give a look at the last two plots in this example > > http://matplotlib.org/examples/pylab_examples/demo_tight_layout.html or > use > > plot.axes providing the rectangle that you want > > That is closer to what I want, but still not there. I was finally able > to find something that fit the bill to 95% of what I want: > > > http://matplotlib.1069221.n5.nabble.com/Proposal-for-Broken-Axes-td38050.html > > The first post by 'klukas' does exactly what I asked for. It's a > zig-zag on the Y-axis to show that what is graphed is not continuous, > and unlike the various "official" examples, the zig-zag placement is > user-specifiable, as opposed to exactly halfway between the top and > bottom. > > The only thing I have yet to figure out how to do is to simultaneously > have a zig-zag on the X axis as well -- an artifact of how these > zig-zags must be created via multiple axes on the same figure, rather > than as built in to the axis artist. > > For googleability: > > The above linked graph code enables for matplotlib: > > - suppressed zeros on the Y-axis of an XY plot > - showing suppressed data on the Y-axis > - lightning bolt symbol on the Y-axis > - zig-zag on the Y-axis > - a "broken" Y-axis > > Thanks for your pointers, Francesco, as they helped me to fine-tune my > Google search terms. And thank you, Klukas, whoever you are. > > Cheers, > > Kevin > > ------------------------------------------------------------------------------ > > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > Matplotlib-users mailing list > [hidden email] <http://user/SendEmail.jtp?type=node&node=40857&i=0> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://matplotlib.1069221.n5.nabble.com/zig-zag-to-represent-suppressed-0-on-axis-tp40849p40857.html > To start a new topic under matplotlib - users, email > ml-...@n5... > To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx> > . > NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************ break_axis.jpg (182K) <http://matplotlib.1069221.n5.nabble.com/attachment/40858/0/break_axis.jpg> -- View this message in context: http://matplotlib.1069221.n5.nabble.com/zig-zag-to-represent-suppressed-0-on-axis-tp40849p40858.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Francesco M. <fra...@gm...> - 2013-04-08 21:00:58
|
Il giorno 08/apr/2013 21:05, "Kevin Hunter Kesling" <kmh...@nc...> ha scritto: > > At 4:20pm -0400 Sun, 07 Apr 2013, Francesco Montesano wrote: >> >> Il giorno 07/apr/2013 21:03, Kevin Hunter Kesling ha scritto: >> >>> On the other hand, I'm still such a noob at Matplotlib ... is there >>> a way to have one of the subplots take up more than its default 50% >>> allotment? >> >> >> you can give a look at the last two plots in this example >> http://matplotlib.org/examples/pylab_examples/demo_tight_layout.html or use >> plot.axes providing the rectangle that you want > > > That is closer to what I want, but still not there. I was finally able to find something that fit the bill to 95% of what I want: > > http://matplotlib.1069221.n5.nabble.com/Proposal-for-Broken-Axes-td38050.html > > The first post by 'klukas' does exactly what I asked for. It's a zig-zag on the Y-axis to show that what is graphed is not continuous, and unlike the various "official" examples, the zig-zag placement is user-specifiable, as opposed to exactly halfway between the top and bottom. > > The only thing I have yet to figure out how to do is to simultaneously have a zig-zag on the X axis as well -- an artifact of how these zig-zags must be created via multiple axes on the same figure, rather than as built in to the axis artist. > > For googleability: > > The above linked graph code enables for matplotlib: > > - suppressed zeros on the Y-axis of an XY plot > - showing suppressed data on the Y-axis > - lightning bolt symbol on the Y-axis > - zig-zag on the Y-axis > - a "broken" Y-axis > > Thanks for your pointers, Francesco, as they helped me to fine-tune my Google search terms. And thank you, Klukas, whoever you are. > I'm half that you found the solution for your problem and to have been useful just providing links. This has been one of the easiest answer I have ever given :) And mostly thanks for sharing your findings. cheers and good night, Fra > Cheers, > > Kevin |