IIRC, you can use plt.setp() for this purpose:
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.setp
Essentially, anything that would come after the "set_" part of an object's
method can be a keyword. So, I think this would work:
plt.setp(ax, xlim=[-0.2, 0.9], ylim=[-100,100], zlim=[-0.3, 0.4])
plt.setp(ax, xlabel='Time [$\mu$s]', ylabel='Bias [V]', zlabel='Voltage[V]')
Note, you no longer need to say "xlim3d" and the likes, it is just "xlim",
"ylim" and "zlim" (as of v1.1, IIRC).
Again, completely untested, and off the top of my head.
Cheers!
Ben Root
On Wed, Feb 5, 2014 at 3:49 PM, Arun Persaud <apers...@lbl.gov> wrote:
> Hi
>
> Hope this is the right place to post a request for enhancement.
>
> I often create a bunch of relatively basic plots using matplotlib and
> the commands to set the labels and limits take up more space than the
> actual plotting commands (figure, plot, show), so I was wondering if
> there is a shorter way of doing this (I couldn't find one) and if not,
> if a shortcut notation could be added.
>
> Here are some code lines I use at the moment:
>
> 3d plot:
>
> ax.set_xlabel('Time [$\mu$s]')
> ax.set_xlim3d(-0.2, 0.9)
> ax.set_ylabel('Bias [V]')
> ax.set_ylim3d(-100, 100)
> ax.set_zlabel('Voltage[V]')
> ax.set_zlim3d(-0.3, 0.4)
>
> 2d plot:
>
> plt.xlabel('Time [$\mu$s]')
> plt.ylabel('Voltage [V]')
> plt.xlim(0, 100)
> plt.ylim(0, 50)
>
>
>
> proposed syntax:
>
> # Z being optional
> plt.labels(X='Time [$\mu$s]', Y='Bias [V]', Z='Voltage[V]')
> plt.limits(X=[-0.2, 0.9], Y=[-100,100], Z=[-0.3, 0.4])
>
>
>
> label could also have a **kwargs that would be handed on to all
> [xyz]label, in case one needs to set fontsize for all labels.
>
> label could also have an optional title=''.
>
> limits could test for 2d or 3d plots and call the correct functions
> automatically.
>
> Arun
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel