SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] Proposal for Broken Axes

From: ayuffa <ay...@gm...> - 2011年07月07日 20:54:39
Have your changes to axes.py, namely breakx and breaky, been accepted? If
not, could you post your axes.py file.
Thanks in advance,
yuffa
klukas wrote:
> 
> I have implemented breakx and breaky methods for the Axes class and
> attached the diff for axes.py to this message.
> 
> You can test out the function with the following examples:
> ------------------
> import numpy as np
> import matplotlib as mpl
> import matplotlib.pyplot as plt
> 
> # Broken y
> fig = plt.figure()
> main_axes = plt.axes()
> plt.title('Broken x-axis example')
> plt.xlabel('x-axis label')
> subaxes = main_axes.breaky([0., 1.9, 5.1, 6.9, 9.1, 12])
> for axes in subaxes:
> axes.plot(np.linspace(0,12,13),np.linspace(0,12,13))
> plt.ylabel('y-axis label')
> plt.show()
> 
> ------------------
> import numpy as np
> import matplotlib as mpl
> import matplotlib.pyplot as plt
> # Broken x
> fig = plt.figure()
> main_axes = plt.axes()
> plt.title('Broken x-axis example')
> plt.ylabel('y-axis label')
> subaxes = main_axes.breakx([0., 1.9, 5.1, 6.9, 9.1, 12])
> for axes in subaxes:
> axes.plot(np.linspace(0,12,13),np.linspace(0,12,13))
> plt.xlabel('x-axis label')
> plt.show()
> ---------------------
> 
> I've included in the docstrings some of the TODO items, but this is
> pretty stable in its current form.
> 
> Cheers,
> Jeff
> 
> || Jeff Klukas, Research Assistant, Physics
> || University of Wisconsin -- Madison
> || jeff.klukas@gmail | jeffyklukas@aim | jeffklukas@skype
> || http://www.hep.wisc.edu/~jklukas/
> 
> 
> On Tue, Mar 16, 2010 at 1:08 PM, Jeff Klukas wrote:
>>> What would be great is if you could refactor the basic functionality
>>> into a matplotlib.Axes.breaky method (and possibly breakx but most
>>> people request a broken y axis), which would resize the "self" axes
>>> and return the broken compliment which could be plotted onto. Then
>>> you could provide a thin pyplot wrapper much like pyplot.twinx, so
>>> that pyplot as well as API users could benefit.
>>
>> I can try to do this. I think I would prefer, however, not to resize
>> the "self" axes and continue with my current approach of creating two
>> new axes within the original axes. On the user end, I think it makes
>> more sense to set the title and ylabel of the main axes, rather than
>> setting them for the individual upper and lower axes. More on that
>> below.
>>
>>>> The only real problems here is that you need to
>>>> explicitly plot things on both the upper and lower axes, and then I
>>>> haven't
>>>> figured out how to push out the y-axis label of the main axes object so
>>>> it
>>>> doesn't overlap with the tick labels of the upper and lower axes. So,
>>>> I
>>>> instead moved the y-labels of the upper and lower axes so that they
>>>> appear
>>>> at the center of the axis, but this is problematic. Any thoughts on
>>>> how to
>>>> do that part better?
>>>
>>> klukas, I'm afraid I don't understand your issue... Can you explain
>>> using it differently?
>>
>> In my approach, you end up with a main axes object that is invisible,
>> and then two visible axes objects (upper and lower) within the main
>> axes. I would ideally like to have the y label display in the middle
>> of the main y-axis, independent of where the break lies. If I place a
>> y label on the main axes (which has ticks or tick labels), though, it
>> appears right up against the axis line. I'd like it to be placed
>> further to the left, clear of the tick labels that appear on the upper
>> and lower axes. So, I'd like to be able to access whatever algorithm
>> is used to choose the offset of the axis label, and explicitly set the
>> offset of the ylabel for the main axes so that it clears the tick
>> labels.
>>
>> // Jeff
>>
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> 
> 
-- 
View this message in context: http://old.nabble.com/Proposal-for-Broken-Axes-tp27909750p32016821.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /