SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(10)
2
(10)
3
(9)
4
(3)
5
(2)
6
(6)
7
(12)
8
(21)
9
(4)
10
(19)
11
(7)
12
(2)
13
(28)
14
(13)
15
(27)
16
(17)
17
(21)
18
(22)
19
(3)
20
(25)
21
(17)
22
(16)
23
(28)
24
(19)
25
(4)
26
(4)
27
(23)
28
(13)
29
(15)
30
(19)


Showing 7 results of 7

From: freeeeeekk <fre...@gm...> - 2010年09月11日 23:57:30
Im trying to do a very simple x vs y plot. Where the x values range between
3247 and 3256 and y between 0 and 1. This data is stored in data.dat. I plot
it using the code below, the resulting plot is shown in the first of the two
plots below. Everything goes well except for the x axis, for some reason
tickmarks from 0 up to 9 appear. At the far end of the axis my xmin is
printed: 3.247e3. 
I started looking for the cause and it turns out that as long as my range in
x is lower than 10, this happens. If I change the xlimits to xlim(3246,3256)
I get the plot at the bottom of this page, everything is fine. But if I
change this to for instance xlim(3246.01,3256) or xlim(3245, 3254.99) I get
the same behaviour as in the first graph. 
Does any one have any experience with this/ know the reason for this
happening? Thanks!
from numpy import *
from pylab import *
datafile = mlab.load('./data.dat')
xx=datafile[:,0]
yy=datafile[:,1]
plot(xx,yy,'black')
xlim(3247,3256)
ylim(0,1.2)
show()
http://old.nabble.com/file/p29687404/wrong.png 
http://old.nabble.com/file/p29687404/right.png 
-- 
View this message in context: http://old.nabble.com/weird-behaviour-in-x-axis-tp29687404p29687404.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Alan G I. <ala...@gm...> - 2010年09月11日 20:04:25
On 9/10/2010 5:27 AM, Nils Wagner wrote:
> what is needed to save a figure when the size is given in
> pixels, i.e. 1024x772 ?
> The default is 800x600 pixels.
Did you already get an answer?
My understanding is that you set the figure size in *inches*,
and then by setting its ``dpi`` you determine the number of
pixels. (So "inches" are purely virtual, unless you match
the ppi of your display/printer.)
hth,
Alan Isaac
From: Oz N. <na...@gm...> - 2010年09月11日 19:10:44
Hi Everyone again,
So, with the weekend comes some time to think and I found an answer to
another question of mine.
I know now how to remove xticks in colorbar, and I also know how to
customize the widths of the lines in the color bar.
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from pylab import *
matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'
delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)
# Create a simple contour plot with labels using default colors. The
# inline argument to clabel will control whether the labels are draw
# over the line segments of the contour, removing the lines beneath
# the label
plt.figure()
CS = plt.contour(X, Y, Z)
plt.clabel(CS, inline=1, fontsize=10,inlinespacing=50)
a=plt.colorbar()
ticks = a.ax.get_xticklines()
lines = a.ax.get_ygridlines()
children=a.ax.get_children()
children=a.ax.get_children()
children[4].set_linewidths([12,12,12,12,12,12])
for tick in ticks:
 setp(tick, [])
plt.title('Customize colorbar')
I hope someone finds that useful. And someone is still following my
monologue, my question, how to remove the axes around the colorbar, or at
least changed the to be non-visible, still stands...
Thanks,
Oz
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: Friedrich R. <fri...@gm...> - 2010年09月11日 18:12:38
2010年9月4日 Thomas Robitaille <tho...@gm...>:
> export MACOSX_DEPLOYMENT_TARGET=10.6
> export CFLAGS="-arch i386 -arch x86_64"
> export CPPFLAGS="-arch i386 -arch x86_64"
> export FFLAGS="-arch i386 -arch x86_64"
> export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
So you're on 10.6? (Because of the DEPLOYMENT_TARGET.)
In general, distutils chooses the flags and tweaks them to match the
options used when compiling Python. Did you install Python from
source, and if yes, maybe with ppc?
> ARCH_FLAGS="-arch i386-arch x86_64"
I don't know how the ARCH_FLAGS are interpreted.
> gcc-4.0 -DNDEBUG -g -O3 -arch i386 -arch x86_64 [...] -isysroot /Developer/SDKs/MacOSX10.6.sdk [...]
gcc-4.0? Thought you are on 10.6, there gcc-4.2 is the default.
Further, this looks to me like you're using python.org Python, which
is indeed gcc-4.0 compiled afaik. Maybe you're even using Apple
Python?? (Don't know which compiler this is using.)
So far, it's a bit incomplete, and sorry for the huge delay,
Friedrich
From: Friedrich R. <fri...@gm...> - 2010年09月11日 17:53:45
2010年9月10日 Yannis Haralambous <yan...@te...>:
> when I launch the DMG installer matplotlib-1.0.0-python.org-py2.6-macosx10.4.mpkg
> I get an error message, that my volume does not contain "System Python 2.6".
> I'm running a standard MacOS X 10.6.4 with python 2.6.1 running from /usr/bin
> And I do have Python 2.6 installed in
> /System/Library/Frameworks/Python.framework/Versions/2.6
> Why does the installer doesn't sees it?
Several possible reasons:
1) You installed Python from source. In this case, since the mpl
installer checks using the Apple package system (yes, there is
actually a package system on Mac!), and installing from source of
course does not register with this, the installer wouldn't be able to
find the "Python" package.
2) There is a mistake in the matplotlib installer. This happened
before already.
3) You're not running Python from the python.org installer, but rather
Python from Apple.
4) I noticed that you're using the macosx10.4 installer, but you said
you're on 10.6? Libraries on 10.6 are built with gcc-4.2, and the
libs from the 10.4 bundle are built certainly with gcc-4.0. In this
case it cannot load the gcc-4.2 built libraries.
You can try to search the /matplotlib/ threads for this, we had
several threads on this before. I remember no issue atm on this list
about this not solved. But I may overestimate. You can also keep
asking.
Btw, where does your freetype2 come from? How did your build find it
(i.e., do you have pkg-config or not)?
Friedrich
From: Tony S Yu <ts...@gm...> - 2010年09月11日 17:20:26
On Sep 11, 2010, at 12:00 PM, Radek Machulka wrote:
> Hi Folks,
> 
> I am trying to do something similar to
> http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html,
> but with a line plots instead of histograms.
> My problem is how to set orientation of line plot if there is no
> 'orientation' argument (line axHisty.hist(y, bins=bins,
> orientation='horizontal') in the example).
> 
> Thanks a lot
> Radek
Since a line plot doesn't really have an orientation, this might be a lot simpler than you think. If I understand your question, you can just switch your x and y data to get the desired behavior.
Continuing the example you link to, just remove the lines that create the histogram (last 4 lines before plt.show) and replace with normal plot commands; for example:
bins = np.arange(-lim, lim + binwidth, binwidth)
x_hist, _ = np.histogram(x, bins=bins)
y_hist, _ = np.histogram(y, bins=bins)
x_bin_centers = y_bin_centers = (bins[:-1] + bins[1:])/2.
axHistx.plot(x_bin_centers, x_hist)
axHisty.plot(y_hist, y_bin_centers)
plt.show()
The first line above marks the last line in the example script that you should keep. Note that you don't have to use histogram data (x_hist, y_hist); I only do so to simplify the example. Also, x_bin_centers and y_bin_centers are only equal because the scatter data is square.
Is this what you were going for?
-Tony
From: Radek M. <rad...@gm...> - 2010年09月11日 16:00:52
Hi Folks,
I am trying to do something similar to
http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html,
but with a line plots instead of histograms.
My problem is how to set orientation of line plot if there is no
'orientation' argument (line axHisty.hist(y, bins=bins,
orientation='horizontal') in the example).
Thanks a lot
Radek

Showing 7 results of 7

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 によって変換されたページ (->オリジナル) /