[Matplotlib-users] zoom a plot

2014-09-15 Thread Xiaobo Yang
Hi, I use matplotlib to create a png file, then display it in a web
browser. All works fine. Now I want to zoom the plot. What I can think of
is:

1) Get coordinates (x1, y1), (x2, y2) of the image when user makes an area
selection on the image;

2) Convert (x1, y1), (x2, y2) to the real values matplotlib was plotting;

3) Request matplotlib to create a new png file using the updated area
values.

Could anybody please let me know how to accomplish step 2?

Many thanks,
Tom
--
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] get_xlim of dates

2014-09-16 Thread Xiaobo Yang
Hi,

My X axis represents dates. When I used get_xlim(), I got something like
735461.0 and 735490.5. What are these values? How can I convert to python
date objects?

Many thanks,
Tom
--
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] get_xlim of dates

2014-09-16 Thread Xiaobo Yang
many thanks - was struggling to find out where's the document!

On 16 September 2014 17:20, Scott Lasley  wrote:

>
> On Sep 16, 2014, at 11:31 AM, Xiaobo Yang  wrote:
>
> > Hi,
> >
> > My X axis represents dates. When I used get_xlim(), I got something like
> 735461.0 and 735490.5. What are these values? How can I convert to python
> date objects?
> >
> > Many thanks,
> > Tom
>
> See the matplotlib dates documentation at
>
> http://matplotlib.org/api/dates_api.html
>
>
--
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Basemap scatter plot, set color according to value

2014-09-22 Thread Xiaobo Yang
Hi,

I want to show some points on a world map. But the color of a point is
linked to the value at the point. Any idea why the code below does not give
what I want (same color, no legend)?

Many thanks,
Tom

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np

lats = [47.8, -54.85, 47.0544, 44.18, 47.42, 46.55]
lons = [11.02, -68.32, 12.9583, 10.7, 10.98, 7.99]
scores = [4.93657698397, -31.0626756529, 35.2049971001, 23.1060270438,
12.5139213403, 17.3946319493]

map = Basemap(projection = 'mill')
map.drawcoastlines()
map.drawmapboundary()

for lat, lon, score in zip(lats, lons, scores):
print('Score at (%f, %f) is %f' % (lat, lon, score))
x, y  = map(lon, lat) # Notice x = lon, y = lat
map.scatter(x, y, marker = 'o',
s = 500,
c = score,
cmap = plt.get_cmap('rainbow'))

plt.legend()
plt.show()
--
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users