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


Showing 4 results of 4

From: Daniel M. <dan...@go...> - 2011年06月04日 12:58:03
Hi,
have you tried the examples that I have provided a couple days ago,
see below? I cannot see why it should not work. These are the absolute
basics that you need to understand.
Btw, there is no need to use csv2rec unless you want/need column or row headers.
Here's a full script that does what you want. Now, please take the
time and work through the example that I have provided. In case you
need further help, please don't start a new thread but reply to this
one.
Best regards,
Daniel
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import pylab
import scipy
datafile1 = 'ch1_s1_lrr.csv'
datafile2 = 'ch1_s1_baf.csv'
## create dummy data
data = pylab.rand(10000,12)
pylab.savetxt(datafile1, data, delimiter=';')
pylab.savetxt(datafile2, data, delimiter=';')
## load data and transpose
a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';').T
print 'loading', datafile1
b1 = pylab.loadtxt(datafile2, comments='#', delimiter=';').T
print 'loading', datafile2
## axis limits
#v1 = [0,98760,0,1]
#v2 = [0,98760,-2,2]
v1 = [0,1]
v2 = [-2,2]
plt.close('all')
plt.figure()
plt.subplot(2,1,1)
#plt.axis(v2)
plt.ylim(v2)
#plt.plot(a1, 'r.')
for i in range(6):
 plt.plot(a1[i])
plt.subplot(2,1,2)
#plt.axis(v1)
plt.ylim(v1)
#plt.plot(b1, 'b.')
## need masked arrays here
## http://physics.nmt.edu/~raymond/software/python_notes/paper003.html
m = b1 >= 0.05
b1masked = scipy.ma.array(b1,mask=m)
## print first two cols
print b1masked[0:2]
for i in range(6,12):
 plt.plot(b1masked[i])
plt.show()
2011年6月3日 Karthikraja Velmurugan <vel...@gm...>:
> import matplotlib.pyplot as plt
> import pylab
> datafile1 = 'ch1_s1_lrr.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)
>
> plt.subplot(2,1,1)
> print 'loading', datafile1
> plt.axis(v2)
> plt.plot(a1, 'r.')
>
> plt.subplot(2,1,2)
> print 'loading', datafile2
> plt.axis(v1)
> plt.plot(b1, 'b.')
>
> plt.show()
2011年5月30日 Daniel Mader <dan...@go...>:
> 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 range of e.g. rows 3 to 6 is
> range36 = a1[2:6]
>
> Please have a look here for getting started with scipy/numpy:
> http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html
> and
> http://www.scipy.org/NumPy_for_Matlab_Users
>
> Hope this helps,
> Daniel
>
> 2011年5月27日 Karthikraja Velmurugan <vel...@gm...>:
>> Hello Daniel,
>>
>> The code you have given is simple and works fab. Thank you very much. But I
>> wasn't able to find an example which accesses the columns of a CSV files
>> when I import data through "datafile="filename.csv"" option. It will be
>> great if you could help with accessing individual columns. What excatly I am
>> looking for is to access individual coulmns (of the same CSV file), do
>> calculations using the two coumns and plot them into seperate subplots of
>> the same graph.
>> I modified the script a lil bit. Please find it below:
>>
>> import matplotlib.pyplot as plt
>> import pylab
>> datafile1 = 'ch1_s1_lrr.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)
>> plt.subplot(4,1,1)
>> print 'loading', datafile1
>> plt.axis(v2)
>> plt.plot(a1, 'r.')
>> plt.subplot(4,1,2)
>> print 'loading', datafile2
>> plt.axis(v1)
>> plt.plot(b1, 'b.')
>> plt.show()
>>
>> Thank you very much in advance for your time and suggestions.
>>
>> Karthik
From: Nick V. <ni...@ev...> - 2011年06月04日 11:58:07
I have a small problem which I suspect can be solved in an easy and
elegant way, and it is simply lack of sleep/stupidity preventing me
from finding it.
I have a number of line drawings comprised of cartesian points. I need
to project them onto a sphere (they are drawings of constellations, so
I need to project them onto an imaginary celestial sphere) and convert
the points into sphercal co-ordinates.
I *can* map the points to a sphere, that's no problem. But obviously,
when I do this they become distorted. What I want to do is find out
what the points should be to get an undistorted view - i.e the mapping
that will produce a projection so the points match the cartesian
version. Obviously, I realise this depends on the projection used etc,
but basically, a small amount of distortion is fine. I am sure there
must be a simple way to achieve this, but I can't seem to manage it.
---
Nick Veitch
From: Nick V. <ni...@ev...> - 2011年06月04日 11:45:09
I have a small problem which I suspect can be solved in an easy and
elegant way, and it is simply lack of sleep/stupidity preventing me
from finding it.
I have a number of line drawings comprised of cartesian points. I need
to project them onto a sphere (they are drawings of constellations, so
I need to project them onto an imaginary celestial sphere) and convert
the points into sphercal co-ordinates.
I *can* map the points to a sphere, that's no problem. But obviously,
when I do this they become distorted. What I want to do is find out
what the points should be to get an undistorted view - i.e the mapping
that will produce a projection so the points match the cartesian
version. Obviously, I realise this depends on the projection used etc,
but basically, a small amount of distortion is fine. I am sure there
must be a simple way to achieve this, but I can't seem to manage it.
---
Nick Veitch
From: Jae-Joon L. <lee...@gm...> - 2011年06月04日 05:46:55
The first argument of the "label" command is a list of artist to be
labeled. And it does not matter whether they are associated with axes
or not. What you can do, therefore, is
 1) draw something as you want them in the legend
 2) remove them from the axes
 3) make a legend from these artists.
 l1, = plt.plot([1,2,3])
 l1.remove()
 plt.legend([l1], ["test"])
If you know how to create artists w/o using axes method (or. pyplot
function), you may do so of course.
Regards,
-JJ
On Thu, Jun 2, 2011 at 3:41 AM, htaunay <ht...@gm...> wrote:
>
> Is there anyway to set/create legends independent of what I am plotting?
> Simply manually create, position and show legends, that not necessarily are
> directly linked to the graph.
>
> To be specific, I am plotting several points, in a scatter form,
> individually, and depending on the given attributes, I manually set what
> colour and marker each point will present. My intention is to create legends
> that specify the categories of my data, in a way that I can manually define
> what colour/marker they are linked to.
>
> Thanks in advance for any help!
> --
> View this message in context: http://old.nabble.com/Independent-Legends-tp31752112p31752112.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

Showing 4 results of 4

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