ah, should have been:
ax1.grid()
ax2.grid()
ax1.yaxis.grid(False)
--
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev___
M
Hi Paul,
thanks for your efforts, I've figured it out by myself by now, with you
pieces of code:
ax1.grid()
ax2.grid()
ax1.xaxis.grid(False)
does the trick :)
--
This SF.net email is sponsored by Windows:
Build for Wind
Hi Paul,
I've modified your suggestion a little, since I don't want a grid for the
primary axis at all -- unfortunately to no avail, i.e. no grid line at all:
import numpy
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
datax = numpy.arange(50)
data1 = numpy.sin(data
Hi,
I need a twinx() plot with horizontal and vertical grid lines for the
second axis, just like the usual grid for the first axis. I don't need or
want to specify the ticks manually, though!
My example code just produces horizontal lines:
import pylab
datax = pylab.arange(50)
data1 = pylab.s
Hi,
why don't you just parse the returned string?
asdf = '3:04:02.994000'
asdf = asdf.split(':')
temp = asdf[-1].split('.')
print asdf
asdf.pop(-1)
print asdf
asdf.extend(temp)
print asdf
asdf = [int(i) for i in asdf]
print asdf
hrs,mins,secs,usecs = asdf
That should work, and you can always tra
> Yes, it is a known problem, and it is by design. However, the OP has a good
> point that the gallary should have nice-looking plots. Therefore, it would
> make sense to modify those really bad examples with subplot_adjust() to
> allow them to look better.
Very much agreed :)
-
Hi,
this is a known problem when working with subplots, reducing the
figure size or increasing the font size. It is like that by design but
there are workarounds.
http://old.nabble.com/Feature-request%3A-automatic-scaling-of-subplots,-margins,-etc-td31556961.html
http://old.nabble.com/faq%3A-redu
Hi Karthik,
I cannot find any problem with your code. You are mixing modules a little
too much to my taste but it's not a technical problem.
Loading and saving the data works flawless here. Attached is an infile and a
modified script, please try this.
2011/6/11 Karthikraja Velmurugan
> *Hi Dan
;,
'\usepackage{sfmath}',
'\usepackage{gensymb}',
'\usepackage{amsmath}',
]
Thanks a lot for clarification!
2011/6/9 Stan West :
>> From: Daniel Mader [mailto:[email protected]]
>> Sent: Thursday, June 09, 2011 11:59
>>
>> Hi,
I also use LaTeX with utf8 input encoding (and imho the required
preamble is fully OK since it is 100% LaTeX) when generating PDF
graphics -- but I do that only on a Linux box, so I can't verify for
Windows...
2011/6/9 Klonuo Umom :
> AFAIK I used this when working LaTeX in UTF-8:
> ==
Hi,
I just noticed this doesn't work here, too, as I expected :(
with u'äöüß°€' I can print the string, but the labels are still broken
in the plot:
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
xlabel = r'öäüß°€'
plt.xlabel(xlabel)
plt.show()
plt.savefig('asdf')
Hi,
try putting an r in front of your string:
e.g. label=r'äöü߀'
And it might help to tell your editor the used encoding, too, by
putting this as the first line:
# -*- coding: utf-8 -*-
Hope this helps,
Daniel
2011/6/9 Klonuo Umom :
> Hi,
>
> How can I use font in my locale or even better UTF-
, 0.5, 0.02])
fig.colorbar(im2, cax, orientation='horizontal')
Ideally, I'd need to create a new subfig 313 with a much reduced height.
Either way, you helped me a lot!
2011/6/7 Eric Firing :
> On 06/07/2011 01:37 AM, Daniel Mader wrote:
>>
>> Hi Eric,
>>
>
Hi Eric,
2011/6/6 Eric Firing :
> It's not quite clear to me yet, but I assume you want to use a call to
> imshow with a different data set in the second subplot, but have the
> color scale and colorbar be identical to those in the first subplot. Is
> that correct? If so, all you need to do is
Hi all,
I'd like to compare two sets of data by using subplots and imshow(). I
have two issues with this:
1) how can I have a colorbar in each subplot?
2) how can I adjust the range limits for a colorbar, so that the
comparison possible?
Below is code which could serve as a starting point, I hop
rr.csv'
> datafile2 = 'ch1_s1_baf.csv'
>
> a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';')
> b1 = pylab.loadtxt(datafile2, comments='#', delimiter=';')
>
> v1 = [0,98760,0,1]
> v2 = [0,98760,-2,2]
>
> plt.figure(1)
&
Hi Corbin,
it is pretty much impossible that you will get a reply here that helps
you to become a professional Python programmer from scratch without
asking a specific question :)
Please try to read some introductory courses and create your first
sample plots, and then ask. I am sure you will get
Hi,
the content of the CSV is stored as an array after reading. You can
simply access rows and columns like in Matlab:
firstrow = a1[0]
firstcol = a1.T[0]
The .T transposes the array.
The second element of the third row would be
elem32 = a1[2][1]
which is equivalent to
elem32 = a1[2,1]
A rang
Hi,
firstly, I do not fully understand why you have chosen such a complicated
solution to a rather simple problem. If the data in your file really is like
the example then you could simply put the file 'ch1.csv' into the same
directory as your Python script.
I have slightly modified it (I don't l
Hi again,
>> Hi Jae-Loon,
>>
>> thanks for your comments! Of course I do agree that a figure layout
>> should not change in interactive mode. However, I don't see why this
>> should happen upon a panning action. A different case is when the
>> label or title font sizes are changed, but I was assum
aniel
2011/5/11 Jae-Joon Lee :
> On Fri, May 6, 2011 at 5:20 PM, Daniel Mader
> wrote:
>> From many postings here I have learned that
>> this is the absolute intention, i.e. it is broken by design unless the
>> programmer takes care about this.
>
> I think there are p
Hi, I like this, too.
However, I don't understand why it works at all. Usually, when I apply
a colormap, I need to take care about the scaling myself, i.e. divide
the range up into the number of elements to plot:
import pylab as pl
import matplotlib.cm as cm
xval = pl.arange(0, 20, 0.2)
n = 256
Very nice, will try this asap!
Many thanks!
2011/5/6 Tony Yu :
>
> On Fri, May 6, 2011 at 5:55 AM, Chris Rodgers
> wrote:
>>
>> The real solution of course is to calculate exactly where every piece
>> of text actually is, detect overlaps, and adjust. That is certainly
>> beyond my ability or inc
Hi,
almost every time I create a somewhat more complex figure I have to
fight with the not too smart positioning of the plots and the size of
margins around the axes. From many postings here I have learned that
this is the absolute intention, i.e. it is broken by design unless the
programmer takes
03/10/2011 01:13 AM, Daniel Mader wrote:
>> Maybe I should mention that there are actually two reasons why I don't
>> like this behavior:
>>
>> 1) it's sometimes very hard to read what's going on,
>> 2) there also seems to be a bug when the limits are ch
)
## modify the limits
ax2.set_ylim((y1/2., y2/2.))
ax2.figure.canvas.draw()
ax1.callbacks.connect("ylim_changed", update_ax2)
ax1.ticklabel_format(useOffset=False, axis='y')
##------
pylab.show(
Hi Ben,
thanks a lot, this really helpes in the simple example, I'll try to
find out how to use it in the complex script. It seems 1.0.0 is recent
enough for this!
Thanks again,
Daniel
2011/3/10 Benjamin Root :
>
>
> On Thu, Mar 10, 2011 at 4:54 AM, Daniel Mader
> wrote:
>
Hi,
is it possible to change the default y-axis scaling so that the
ticks/label are not with respect to the large offset?
For example:
import scipy
import pylab
x = scipy.arange(100)
y = scipy.rand(100) + 106
pylab.figure()
pylab.plot(x,y)
pylab.grid()
pylab.show()
This gives the y-limit
Hi,
have you tried to print the EPS without putting it into a DOC? Is
there a specific reason for why you don't use an PNG for that task?
Can Word print EPS at all?
Best,
Daniel
2011/3/1 Zhaoru Zhang :
> Hi,
>
> I created an eps figure file with matplotlib. I can look at it via mac
> preview, b
I have slightly modified the example from
http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels
in order to demonstrate what I mean.
It works with the manual string tick labels but not with regular
auto-generated numerical ones.
Maybe someone knows how to fi
There is the one in the code, as suggested on the FAQ site :)
>> thanks for pointing out the rcParams solution! For the time being,
>> this seems an OK approach. I'd like to use the automatic solution,
>> though
>
> There isn't one.
wer')
ax.plot(x,y)
labels = ax.get_yticklabels()
fig.canvas.mpl_connect('draw_event', on_draw)
fig.savefig('example_mpl-ticker_2')
2011/2/25 Darren Dale :
> On Tue, Feb 22, 2011 at 4:23 AM, Daniel Mader
> wrote:
>> Hi,
>>
>> there has been a similar question recently
Hi Waléria,
you should try to figure out the docstring help :)
In a terminal (IDLE or IPython), just do
import matplotlib
matplotlib.errobar?
This will show you extensive help on the command.
You will also need to compare with the regular plot command:
matplotlib.plot?
Best regards,
Daniel
P.
Hi Waléria,
in order to test it and help you without spending too much time on it,
could you please provide a stripped example which runs standalone?
As a general rule you should set limits at the very end of the
plotting code in order to prevent them from being superseded by
another command!
Th
Hi,
there has been a similar question recently but I couldn't figure out
if or how this is solved:
I'd like to reduce the figure size so that I can add it to a LaTeX
document without scaling (PDF output with LaTeX font rendering). For
that, I need to adapt the font sizes, too.
Unfortunately, the
Thanks a lot Thomas,
besides that it should be
fig.colorbar(im)
instead of
ax.colorbar(im)
the example works great!
Best regards,
Daniel
2011/2/7 Eric Firing
> On 02/07/2011 10:48 AM, Daniel Mader wrote:
> > Hi,
> >
> > I am trying to add a (configurable) colorbar
Hi,
I am trying to add a (configurable) colorbar to a an array which I simply
plot with imshow().
Could anyone please help me how to enhance it with a colorbar?
import scipy,pylab
import matplotlib.cm as cm # colormaps
import matplotlib.colors as col # colormaps
dat = scipy.array([[1,2,3,4],[5,
Hi, I'd very much vote for such a feature, too. It's absolutely not
foolproof currently the way it is :(
What I find weird, too, is that while everthing fits on the canvas for PDF
output, the left side is cropped for PNG.
´
Best regards,
Daniel
2011/2/1 Paul Anton Letnes wrote:
>
> On 10. juni 200
Dear Paul,
thank you very much for the quick reply! Unfortunately, I don't seem to get
things right with your snippet of code:
# prevent the automatic rotation caused by view changes
> ax.yaxis.set_rotate_label(False)
> ax.yaxis.label.set_rotation(45)
>
Traceback (most recent call last):
File
Ah, thank you very much, that helped! It works nicely!
Best regards,
Daniel
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-fre
Hi,
I need to create a huge range of plots with need to fit into a report
(OpenOffice or Word). In order to save the work of manual resizing them when
dragged and dropped, I wanted to preset a correct figure size with a nice
resolution:
pylab.rcParams['figure.figsize'] = 5,4
pylab.rcParams['figur
Hi,
for my thesis I have a large number of plots generated
by--again--a laaarge number of Python scripts.
Now I need a moderate font size for all of them for the thesis while
for a presentation and poster it needs to be much bigger.
In order to keep track of all the plots and files I use
Thank you very much for your patience, your explanations helped me a
very lot in getting beautiful plots for my thesis!
Best regards,
Daniel
--
Protect Your Site and Customers from Malware Attacks
Learn about various malwa
Hi Eric,
thanks for your feedback, it helped a lot! I have some questions left,
see below.
2011/1/14 Eric Firing :
> Quick thoughts with no testing or concrete examples:
>
> 1) Don't set the cmap or norm for the colorbar; let it inherit those
> properties from the mappable to which it is connecte
Hi,
I am trying to plot a set of simulation results of FEM simulations.
With a lot of help from Ben I can plot the deformed shape quite nicely
but I have trouble in applying a colorbar to the plot.
In the attached file there are three results with different results.
How can I apply a "global" co
Dear Ben,
again, thanks for all your support! Still, I am unable to get the plot
done. In your example, each set of elements gets a color where as I
need each element to have its own color.
I'll attach a file to demonstrate. Maybe you know how to get this
done, and sorry that I am a bit slow on t
Um, after seriously playing with the file I realized that the
suggested workaround of generating a closed single polygon won't work
for me: I need the individual quads or triangles in the plot as they
correspond to FEM simulation elements and have stress values assigned
to them...
As far as I unde
Hi,
the same happens with "regular" colorbars, too. Me, too, I didn't
always have this issue but I can't tell when exactly it was
introduced. Looks more like a bug than a feature to me---at least on
screen the result looks ugly.
Best regards,
Daniel
2011/1/12 :
> Hi,
> I used the colorbar with
> Interesting... this will need to be investigated a little bit further. In
> the meantime, making a single polycollection with all the pieces seem to do
> the trick for now. I have attached a modified version of your script to
> demonstrate.
Dear Ben,
this is great news, it works perfectly wel
s plot for
the first time, see attachments.
Again, any help is deeply appreciated!
Best regards, Daniel
2011/1/8 Benjamin Root :
> On Sat, Jan 8, 2011 at 4:07 PM, Daniel Mader
> wrote:
>>
>> Hello,
>>
>> I have a problem with the 3D plotting of PolyCollecti
Hello,
I have a problem with the 3D plotting of PolyCollections with
python-matplotlib-1.0.0 (on openSUSE 11.3 x86_64):
instead of being correctly stacked as in the example
http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html,
the plots are weirdly overlapping. The example works O
51 matches
Mail list logo