I cannot change the axis tick separation or nbins in Axis artist

Hi,
I am working on a plot that requires AxisArtist and I cannot set the tick
separation (or nbins) that I want to avoid overlapping of ticklabels. I read
http://www.ce.mu.edu.tr/sharedoc/python-matplotlib-doc-1.0.1/html/mpl_toolkits/axes_grid/users/axisartist.html#gridhelper,
where they suggest to use the classical set_ticks, but it doesn't work.
  ax.xaxis.set_ticks() does not makes any difference, the ticks are same as
originally, and
  ax.axis["left"].set_ticks() results in an error: 'AxisArtist' object has
no attribute 'set_ticks'
Can somebody help me?
Thanks in advance,
Patricia

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Does "xticks" not do what you want? Maybe I am misundertsanding because you are trying to do something with a raw Artist...

http://matplotlib.org/api/pyplot_api.html?highlight=xticks#matplotlib.pyplot.xticks

Cheers, Jody

···

On Feb 20, 2013, at 10:31 AM, patricia <ptrambauer@...32...> wrote:

Hi,
I am working on a plot that requires AxisArtist and I cannot set the tick
separation (or nbins) that I want to avoid overlapping of ticklabels. I read
http://www.ce.mu.edu.tr/sharedoc/python-matplotlib-doc-1.0.1/html/mpl_toolkits/axes_grid/users/axisartist.html#gridhelper,
where they suggest to use the classical set_ticks, but it doesn't work.
ax.xaxis.set_ticks() does not makes any difference, the ticks are same as
originally, and
ax.axis["left"].set_ticks() results in an error: 'AxisArtist' object has
no attribute 'set_ticks'
Can somebody help me?
Thanks in advance,
Patricia

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Jody Klymak

Dear Jody,
No, I tried it also...
ax.axis["left"].xticks() results in error: 'AxisArtist' object has no
attribute 'xticks'
ax.xticks() results in error: 'Floating AxesHostAxesSubplot' object has no
attribute 'xticks'
plt.xticks() or just xticks() does not produce any change.
Any idea?

http://www.ce.mu.edu.tr/sharedoc/python-matplotlib-doc-.0.1/html/mpl_toolkits/axes_grid/users/axisartist.html#gridhelper
gives some explanation with the The GridHelperRectlinear, but I cannot make
it work

Thanks,
Patricia

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40448.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Perhaps you could include some code that illustrates what you are trying to do? I'm confused if you are trying to do something simple and are just going about it the wrong way, or if you are doing something hard.

If I do

ax=axes()
ax.plot(arange(1.,10.))
xticks(range(0,10,2))
yticks(range(0,10,2))

I get ticks every 2 points.

Thanks, Jody

···

On Feb 20, 2013, at 11:34 AM, patricia <ptrambauer@...32...> wrote:

Dear Jody,
No, I tried it also...
ax.axis["left"].xticks() results in error: 'AxisArtist' object has no
attribute 'xticks'
ax.xticks() results in error: 'Floating AxesHostAxesSubplot' object has no
attribute 'xticks'
plt.xticks() or just xticks() does not produce any change.
Any idea?

http://www.ce.mu.edu.tr/sharedoc/python-matplotlib-doc-.0.1/html/mpl_toolkits/axes_grid/users/axisartist.html#gridhelper
gives some explanation with the The GridHelperRectlinear, but I cannot make
it work

Thanks,
Patricia

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40448.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Jody Klymak

Dear Jody,
This is the original code that I am using:
http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html
It is a code that plots Taylor diagrams.
I would like to get ticks every two points in the standard deviation axis of
the Taylor diagrams to avoid overlapping of labels (as I am making a figure
with several small Taylor Diagrams subplots).
Thanks!
Patricia

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40454.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Patrica,

Could you post a simple, self contained example that demonstrates your
problem (see http://sscce.org/).

I'd like to help you, but don't have the bandwidth to dig through all that
code.

A link to pastebin, a github gist or similar service would be preferred.

-paul

···

On Thu, Feb 21, 2013 at 1:08 AM, patricia <ptrambauer@...32...> wrote:

Dear Jody,
This is the original code that I am using:
http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html
It is a code that plots Taylor diagrams.
I would like to get ticks every two points in the standard deviation axis
of
the Taylor diagrams to avoid overlapping of labels (as I am making a figure
with several small Taylor Diagrams subplots).
Thanks!
Patricia

AxisArtist utilizes a different (compared to the vanilla matplotlib) mechanism for determining tick location etc., so some of the matplotlib commands do not work.

Unfortunately, AxisArtist is still not well documented, and things are often opaque. Below I implemented a method that you can use to control the nbins. To manually specify the tick locations you need to use the FixedLocator.

IHTH,

-JJ

class TaylorDiagram(object):

def set_nbins(self, nbins):

ghelper = self._ax.get_grid_helper() # get grid_helper

ghelper.grid_finder.grid_locator2.set_params(nbins=nbins) # update the parameter of the grid_locator2 (2 means 2nd coordinate).

Helper. invalidate () # invalidate the helper so that new parameters become effective

···

On Thu, Feb 21, 2013 at 6:08 PM, patricia <ptrambauer@…32…> wrote:

Dear Jody,

This is the original code that I am using:

http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html

It is a code that plots Taylor diagrams.

I would like to get ticks every two points in the standard deviation axis of

the Taylor diagrams to avoid overlapping of labels (as I am making a figure

with several small Taylor Diagrams subplots).

Thanks!

Patricia

View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40454.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


Everyone hates slow websites. So do we.

Make your web apps faster with AppDynamics

Download AppDynamics Lite for free today:

http://p.sf.net/sfu/appdyn_d2d_feb


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks a lot JJ, this worked perfectly!
Patricia

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40467.html
Sent from the matplotlib - users mailing list archive at Nabble.com.