|
From: Jeff P. <jef...@se...> - 2005-07-13 16:31:32
Attachments:
sample2.py
|
Hello, I attached a sample. I'm trying to plot a line using markers and I would like those markers to be transparent. I use the keyword 'alpha=0.2' to set the transparency although the marker are not transparent? Does anyone know how to make this work? Thanks for the help! Also, is it possible to set autoscale for just x-axis or just y-axis? I haven't found a way to do this. Thanks again. Jeff |
|
From: John H. <jdh...@ac...> - 2005-07-13 17:41:22
|
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
Jeff> Hello, I attached a sample. I'm trying to plot a line using
Jeff> markers and I would like those markers to be transparent. I
Jeff> use the keyword 'alpha=0.2' to set the transparency although
Jeff> the marker are not transparent? Does anyone know how to make
Jeff> this work? Thanks for the help!
See the recent thread "transparent markerfacecolors"
http://sourceforge.net/mailarchive/message.php?msg_id=12261949
Basically, this is a bug but you can work around it with scatter.
Jeff> Also, is it possible to set autoscale for just x-axis or
Jeff> just y-axis? I haven't found a way to do this. Thanks again.
You can do this by setting a custom ticker.locator for the axis that
you don't want autoscaled, following the examples major_minor_demo*.py
and Chapter 5 of the user's guide.
JDH
|
|
From: Jeff P. <jef...@se...> - 2005-07-13 20:40:01
|
Great thank you.
One more question. I also want to change the tick mark attributes like
color, fontsize, rotation etc. I used these lines of code:
# set x-axes tick label attributes
axesA.set_yticklabels(axesA.get_xticklabels(), rotation=0,
fontsize=5, color='k')
axesD.set_yticklabels(axesD.get_xticklabels(), rotation=0,
fontsize=5, color='k')
# set y-axes tick label attributes
axesA.set_yticklabels(axesA.get_yticklabels(), rotation=0,
fontsize=5, color='k')
axesD.set_yticklabels(axesD.get_yticklabels(), rotation=0,
fontsize=5, color='k')
I get an error because get_ticklabels() returns an instance of label
strings, not the strings themselves. How can I convert these into a
useful string so the above code works? Or is there a better way to do
this?
Thanks again!
-----Original Message-----
From: John Hunter [mailto:jdh...@ni...]
Sent: Wednesday, July 13, 2005 10:41 AM
To: Jeff Peery
Cc: mat...@li...
Subject: Re: [Matplotlib-users] transparent symbols
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
Jeff> Hello, I attached a sample. I'm trying to plot a line using
Jeff> markers and I would like those markers to be transparent. I
Jeff> use the keyword 'alpha=0.2' to set the transparency although
Jeff> the marker are not transparent? Does anyone know how to make
Jeff> this work? Thanks for the help!
See the recent thread "transparent markerfacecolors"
http://sourceforge.net/mailarchive/message.php?msg_id=12261949
Basically, this is a bug but you can work around it with scatter.
Jeff> Also, is it possible to set autoscale for just x-axis or
Jeff> just y-axis? I haven't found a way to do this. Thanks again.
You can do this by setting a custom ticker.locator for the axis that
you don't want autoscaled, following the examples major_minor_demo*.py
and Chapter 5 of the user's guide.
JDH
|
|
From: John H. <jdh...@ac...> - 2005-07-14 18:12:25
|
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
Jeff> Great thank you. One more question. I also want to change
Jeff> the tick mark attributes like color, fontsize, rotation
Jeff> etc. I used these lines of code:
axesA.set_yticklabels(axesA.get_xticklabels(), rotation=0, ....
^ ^
Not your question, but are you mixing up x and y here?
Jeff> I get an error because get_ticklabels() returns an instance
Jeff> of label strings, not the strings themselves. How can I
Jeff> convert these into a useful string so the above code works?
Jeff> Or is there a better way to do this?
There are several ways to customize these properties. One way is to
get a list of ticks and then customize them
xticks = ax.xaxis.get_major_ticks()
labels = [xtick.label1 for xtick in xticks]
lines = [xtick.tick1line for xtick in xticks]
setp(lines, linewidth=2)
setp(labels, color='red', fontsize=20)
The Tick instances have the following attributes, as detailed here
http://matplotlib.sourceforge.net/matplotlib.axis.html#Tick
tick1line : a Line2D instance
tick2line : a Line2D instance
gridline : a Line2D instance
label1 : a Text instance
label2 : a Text instance
gridOn : a boolean which determines whether to draw the tickline
tick1On : a boolean which determines whether to draw the 1st tickline
tick2On : a boolean which determines whether to draw the 2nd tickline
label1On : a boolean which determines whether to draw tick label
label2On : a boolean which determines whether to draw tick label
JDH
|
|
From: Jeff P. <jef...@se...> - 2005-07-14 20:15:42
|
Thanks John that helps. What is required to import so that 'setp' may be
used. I'm using WXAgg backend. Python chokes when I call setp(...).
thanks again.
J
-----Original Message-----
From: John Hunter [mailto:jdh...@ni...]
Sent: Thursday, July 14, 2005 11:12 AM
To: Jeff Peery
Cc: mat...@li...
Subject: Re: [Matplotlib-users] transparent symbols
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
Jeff> Great thank you. One more question. I also want to change
Jeff> the tick mark attributes like color, fontsize, rotation
Jeff> etc. I used these lines of code:
axesA.set_yticklabels(axesA.get_xticklabels(), rotation=0, ....
^ ^
Not your question, but are you mixing up x and y here?
Jeff> I get an error because get_ticklabels() returns an instance
Jeff> of label strings, not the strings themselves. How can I
Jeff> convert these into a useful string so the above code works?
Jeff> Or is there a better way to do this?
There are several ways to customize these properties. One way is to
get a list of ticks and then customize them
xticks = ax.xaxis.get_major_ticks()
labels = [xtick.label1 for xtick in xticks]
lines = [xtick.tick1line for xtick in xticks]
setp(lines, linewidth=2)
setp(labels, color='red', fontsize=20)
The Tick instances have the following attributes, as detailed here
http://matplotlib.sourceforge.net/matplotlib.axis.html#Tick
tick1line : a Line2D instance
tick2line : a Line2D instance
gridline : a Line2D instance
label1 : a Text instance
label2 : a Text instance
gridOn : a boolean which determines whether to draw the
tickline
tick1On : a boolean which determines whether to draw the 1st
tickline
tick2On : a boolean which determines whether to draw the 2nd
tickline
label1On : a boolean which determines whether to draw tick label
label2On : a boolean which determines whether to draw tick label
JDH
|
|
From: Jeff P. <jef...@se...> - 2005-07-20 19:42:44
|
Hello, I;m not sure how to access the tick attributes listed below. I
tried the following:
#turn off ticks
xticks = axes.xaxis.get_major_ticks()
xticks.tick1On = False
xticks.tick2On = False
this doesn't seem to work. How do I access these attributes? Thanks.
Jeff
-----Original Message-----
From: John Hunter [mailto:jdh...@ni...]
Sent: Thursday, July 14, 2005 11:12 AM
To: Jeff Peery
Cc: mat...@li...
Subject: Re: [Matplotlib-users] transparent symbols
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
Jeff> Great thank you. One more question. I also want to change
Jeff> the tick mark attributes like color, fontsize, rotation
Jeff> etc. I used these lines of code:
axesA.set_yticklabels(axesA.get_xticklabels(), rotation=0, ....
^ ^
Not your question, but are you mixing up x and y here?
Jeff> I get an error because get_ticklabels() returns an instance
Jeff> of label strings, not the strings themselves. How can I
Jeff> convert these into a useful string so the above code works?
Jeff> Or is there a better way to do this?
There are several ways to customize these properties. One way is to
get a list of ticks and then customize them
xticks = ax.xaxis.get_major_ticks()
labels = [xtick.label1 for xtick in xticks]
lines = [xtick.tick1line for xtick in xticks]
setp(lines, linewidth=2)
setp(labels, color='red', fontsize=20)
The Tick instances have the following attributes, as detailed here
http://matplotlib.sourceforge.net/matplotlib.axis.html#Tick
tick1line : a Line2D instance
tick2line : a Line2D instance
gridline : a Line2D instance
label1 : a Text instance
label2 : a Text instance
gridOn : a boolean which determines whether to draw the
tickline
tick1On : a boolean which determines whether to draw the 1st
tickline
tick2On : a boolean which determines whether to draw the 2nd
tickline
label1On : a boolean which determines whether to draw tick label
label2On : a boolean which determines whether to draw tick label
JDH
|
|
From: Darren D. <dd...@co...> - 2005-07-20 20:28:02
|
On Wednesday 20 July 2005 03:42 pm, Jeff Peery wrote: > Hello, I;m not sure how to access the tick attributes listed below. I > tried the following: > > #turn off ticks > xticks = axes.xaxis.get_major_ticks() > xticks.tick1On = False > xticks.tick2On = False > > this doesn't seem to work. How do I access these attributes? Thanks. xticks is a list. you'll need to do something like xticks = axes.xaxis.get_major_ticks() for tick in xticks: tick.tick1On = False tick.tick2On = False -- Darren |