From illabhaskar at gmail.com Sun Feb 3 00:25:46 2019 From: illabhaskar at gmail.com (bhaskar illa) Date: Sun, 3 Feb 2019 10:55:46 +0530 Subject: [Matplotlib-users] quiver_matplotlib Message-ID: Hello matplotlib team, I really thank to matplotlib team for great plotting tools allows to us,last three years on words engages with this. I have small query regarding quiver plots.Here I think for generating direction/angles by using "*np.degrees(np.arctan2(v,u))*". But i want to take direction/angles as a *0.5*np.degrees(np.arctan2(v,u))+90 .* Is it possible ??? *Thank you so much and warm regards ...* *Bhaskar illa,* *Research scholar,* *Seismology group,* *CSIR-NGRI.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From illabhaskar at gmail.com Sun Feb 3 00:26:16 2019 From: illabhaskar at gmail.com (bhaskar illa) Date: Sun, 3 Feb 2019 10:56:16 +0530 Subject: [Matplotlib-users] quiver_matplotlib In-Reply-To: References: Message-ID: *Thank you so much and warm regards ...* *Bhaskar illa,* *Research scholar,* *Seismology group,* *CSIR-NGRI.* On Sun, 3 Feb 2019 at 10:55, bhaskar illa wrote: > Hello matplotlib team, > I really thank to matplotlib team for great plotting tools allows to > us,last three years on words engages with this. > I have small query regarding quiver plots.Here I think for generating > direction/angles by using "*np.degrees(np.arctan2(v,u))*". > But i want to take direction/angles as a *0.5*np.degrees(np.arctan2(v,u))+90 > .* > Is it possible ??? > > > *Thank you so much and warm regards ...* > > *Bhaskar illa,* > *Research scholar,* > *Seismology group,* > *CSIR-NGRI.* > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pgrdid2.dat Type: application/octet-stream Size: 14196 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: quiver_1.py Type: text/x-python Size: 1461 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: quiver_2.py Type: text/x-python Size: 1429 bytes Desc: not available URL: From vs at it.uu.se Mon Feb 4 14:19:20 2019 From: vs at it.uu.se (Virgil Stokes) Date: Mon, 4 Feb 2019 20:19:20 +0100 Subject: [Matplotlib-users] Unable to render different colors for specific characters within a LaTeX string Message-ID: <21a1fcf7-ddeb-4c50-b2fd-23a37c362610@it.uu.se> I would like to change the color of a substring within a LaTeX string for a MatPlotLib plot title. The code below gives no errors or warning; but, does not render the color specified. # -*- coding: utf-8 -*- import numpy as np import matplotlib matplotlib.use("WXAgg") import matplotlib.pyplot as plt plt.rc('text', usetex=True) plt.rc('text.latex', preamble = r'\usepackage{xcolor}') N = 50 x = np.random.rand(N) y = np.random.rand(N) fig, ax = plt.subplots() ax.scatter(x, np.cos(x), color = 'blue', marker = "+", s=47.5) ax.set_title(r'$\color{red}{X}X$') #ax.set_title(r"\textcolor{red}{X} $\color{red}{X}$") # does not work either plt.show() How can I render the first X with the color red? --V N?r du har kontakt med oss p? Uppsala universitet med e-post s? inneb?r det att vi behandlar dina personuppgifter. F?r att l?sa mer om hur vi g?r det kan du l?sa h?r: http://www.uu.se/om-uu/dataskydd-personuppgifter/ E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Mon Feb 4 15:06:51 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 4 Feb 2019 15:06:51 -0500 Subject: [Matplotlib-users] Summer stundents In-Reply-To: References: Message-ID: Following up on this (and ccing the user list), Is anyone available and interested in helping to mentor summer students? Tom On Mon, Jan 21, 2019 at 4:22 PM Thomas Caswell wrote: > Folks, > > On this weeks call we discussed if we want to take summer students this > year (either through GSOC or running the JDH summer fellowship again). Is > anyone able and interested in mentoring this summer? > > Notes from the call: > https://paper.dropbox.com/doc/Matplotlib-meeting-agenda--AWH9pSDlOSvrxXBVPR8mLuxUAg-aAmENlkgepgsMeDZtlsYu#:h2=GSOC-&-JDH > > Tom > > -- > Thomas Caswell > tcaswell at gmail.com > -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhirendra.cub at gmail.com Mon Feb 4 17:49:57 2019 From: dhirendra.cub at gmail.com (Dhirendra Kumar) Date: Tue, 5 Feb 2019 04:19:57 +0530 Subject: [Matplotlib-users] Country Boundary from a shapefile: Matplotlib, basemap Message-ID: I am a new user at matplotlib. I am trying to plot a variable from netCDF file averaged over time for India. I wish to read and add the country outline from a shapefile (boundary only). I was successful in plotting the shapefile and the data individually but could not overlay the shapefile boundary over the plot. Is there a way to do it in matplotlib or basemap? what I am looking for looks like this [image: image.png] Thanks Dhirendra -- ======================================== Dhirendra Kumar PhD Student School of Environmental Sciences, JNU New Delhi (India) Contact: +91 9910778043 Alternate email: dhirendra.cub at outlook.com ========================================= -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 15787 bytes Desc: not available URL: From pi at berkeley.edu Tue Feb 5 17:28:34 2019 From: pi at berkeley.edu (Paul Ivanov) Date: Tue, 5 Feb 2019 14:28:34 -0800 Subject: [Matplotlib-users] SciPy 2019 Conference - 10 days left for submissions, registration now open Message-ID: SciPy 2019, the 18th annual Scientific Computing with Python conference, will be held July 8-14, 2019 in Austin, Texas. The annual SciPy Conference brings together over 800 participants from industry, academia, and government to showcase their latest projects, learn from skilled users and developers, and collaborate on code development. The call for abstracts for SciPy 2019 for talks, posters and tutorials is now open. The original deadline for submissions has been extended and the new deadline is February 15, 2019. Conference Website: https://www.scipy2019.scipy.org/ Submission Website: https://easychair.org/conferences/?conf=scipy2019 *Talks and Posters (July 10-12, 2019)* In addition to the general track, this year will have specialized tracks focused on: - Data Driven Discoveries (including Machine Learning and Data Science) - Open Source Communities (Sustainability) *Mini Symposia* - Science Communication through Visualization - Neuroscience and Cognitive Science - Image Processing - Earth, Ocean, Geo and Atmospheric Science There will also be a SciPy Tools Plenary Session each day with 2 to 5 minute updates on tools and libraries. *Tutorials (July 8-9, 2019)* Tutorials should be focused on covering a well-defined topic in a hands-on manner. We are looking for useful techniques or packages, helping new or advanced Python programmers develop better or faster scientific applications. We encourage submissions to be designed to allow at least 50% of the time for hands-on exercises even if this means the subject matter needs to be limited. Tutorials will be 4 hours in duration. In your tutorial application, you can indicate what prerequisite skills and knowledge will be needed for your tutorial, and the approximate expected level of knowledge of your students (i.e., beginner, intermediate, advanced). Instructors of accepted tutorials will receive a stipend. -- _ / \ A* \^ - ,./ _.`\\ / \ / ,--.S \/ \ / `"~,_ \ \ __o ? _ \<,_ /:\ --(_)/-(_)----.../ | \ --------------.......J Paul Ivanov http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 -------------- next part -------------- An HTML attachment was scrubbed... URL: From konstantin.miller at gmail.com Sun Feb 10 14:52:50 2019 From: konstantin.miller at gmail.com (Konstantin Miller) Date: Sun, 10 Feb 2019 20:52:50 +0100 Subject: [Matplotlib-users] Writing a custom Scale class Message-ID: Hi, I have a time series with two values x(t) and y(t), stored in a Pandas data frame df with columns DateTime, ValueX, ValueY. I would like to plot ValueY vs. ValueX. In addition, I would like to see for each data point on the graph the date when it was measured. My idea was to plot(ValueX, ValueY) and then somehow set the labels to DateTime. But not only the visible tick labels. Rather, when I move my mouse over the plot, I would like to see (DateTime, ValueY) for each point, rather then (ValueX, ValueY). Or, another way to see it is, that I would like to plot ValueY vs. DateTime, but scale the x-axis as ValueX. My take was to plt.plot(df.index, df.ValueX), and to write a custom Scale module that receives the data frame upon construction and that scales the x-axis as ValueX and formats the labels as DateTime. I managed to have the right scaling of my x-axis but I can't see any ticks nor tick labels. And when I hover the mouse over the plot, I see (x=nan, y=). I appreciate any help! :) It seems that the documentation for such low-level functionality is sometimes a bit scarce :) Here is a minimum working example: import matplotlib.scale import matplotlib.transforms import matplotlib.pyplot as plt from matplotlib.ticker import AutoLocator, FixedLocator, FuncFormatter, MaxNLocator, ScalarFormatter import numpy as np from numpy import ma import pandas as pd class Scaler(matplotlib.scale.ScaleBase): name = 'scaler' def __init__(self, axis, df, **kwargs): matplotlib.scale.ScaleBase.__init__(self) self.df = df def get_transform(self): return self.Transform(self.df) def limit_range_for_scale(self, vmin, vmax, minpos): min_ = max(vmin, self.df.index.min()) max_ = min(vmax, self.df.index.max()) return min_, max_ def set_default_locators_and_formatters(self, axis): axis.set_major_locator(AutoLocator()) axis.set_major_formatter(ScalarFormatter()) class Transform(matplotlib.transforms.Transform): input_dims = 1 output_dims = 1 is_separable = True has_inverse = True def __init__(self, df): matplotlib.transforms.Transform.__init__(self) self.df = df def transform_non_affine(self, x): if x.ndim > 1: assert x.ndim == 2 and x.shape[1] == 1 y = ma.masked_array(np.zeros_like(x), mask=[False for _ in x]) for i in range(x.shape[0]): if x.ndim == 1: if (int(x[i]) != x[i]) or (x[i] not in df.index): y.mask[i] = True else: y[i] = self.df.at[int(x[i]), 'x'] else: if (int(x[i, 0]) != x[i, 0]) or (x[i, 0] not in df.index): y.mask[i] = True else: y[i, 0] = self.df.at[int(x[i, 0]), 'x'] return y def inverted(self): return Scaler.InvertedTransform(self.df) class InvertedTransform(matplotlib.transforms.Transform): input_dims = 1 output_dims = 1 is_separable = True has_inverse = True def __init__(self, df): matplotlib.transforms.Transform.__init__(self) self.df = df def transform_non_affine(self, x): if x.ndim > 1: assert x.ndim == 2 and x.shape[1] == 1 y = ma.masked_array(np.zeros_like(x), mask=[False for _ in x]) for i in range(x.shape[0]): if x.ndim == 1: if x[i] not in df['x']: y.mask[i] = True else: y[i] = self.df.loc[self.df['x'] == x[i], :].index[0] else: if x[i, 0] not in df['x']: y.mask[i] = True else: y[i, 0] = self.df.loc[self.df['x'] == x[i, 0], :].index[0] return y def inverted(self): return Scaler.Transform(self.df) matplotlib.scale.register_scale(Scaler) df = pd.DataFrame(index=range(1, 11), data={'x': [1, 1.5, 3, 3.5, 5, 5.5, 7, 7.5, 9, 9.5], 'y': range(1, 11)}) fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.plot(df.index, df['y']) ax.set_xlim([df.index[0], df.index[-1]]) ax.set_xscale('scaler', df=df) Cheers Konstantin -- To send me an encrypted email, download my public key from pgp.mit.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic-emmanuel.picca at synchrotron-soleil.fr Fri Feb 15 03:44:02 2019 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Fri, 15 Feb 2019 08:44:02 +0000 Subject: [Matplotlib-users] Migrating some code which use NavigationToolbar2QT to matplotlib 2.x AND 3.x Message-ID: Hello, I have this code in one of the project I neded to update. Since we are targetting Debian buster, I need to support matplotlib 2.X (python2) AND matplotlib 3.X (python3) class HiddenToolbar(NavigationToolbar2QT): def __init__(self, corner_callback, canvas): super(HiddenToolbar, self).__init__(canvas, None) self._corner_callback = corner_callback self.zoom() def press(self, event): self._corner_preclick = self._views() def release(self, event): if self._corner_preclick == self._views(): self._corner_callback(event.xdata, event.ydata) self._corner_preclick = None The problem, I have is with the _views() method. The 3.X version, complains that it is not available in the NavigationToolbar2QT. so I would like to know how to rewrite this in order to be 2.X and 3.X compatible. I tryed to find some information in the documentation about this but I did not find it. thanks for your help. Frederic From tcaswell at gmail.com Fri Feb 15 12:10:45 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 15 Feb 2019 12:10:45 -0500 Subject: [Matplotlib-users] Migrating some code which use NavigationToolbar2QT to matplotlib 2.x AND 3.x In-Reply-To: References: Message-ID: Fedric, Hello from NSLS-II! `_veiws` is private so we reserve the right to change it at any time. `.views()` was a Stack of lists of the xlim and ylim of all of the Axes in the Figure. I suggest replacing it with something like class HiddenToolbar(NavigationToolbar2QT): def __init__(self, corner_callback, canvas): super(HiddenToolbar, self).__init__(canvas, None) self._corner_callback = corner_callback self.zoom() def _generate_key(self): limits = [] for a in self.canvas.figure.get_axes(): limits.append([a.get_xlim(), a.get_ylim()]) return limits def press(self, event): self._corner_preclick = self._generate_key() def release(self, event): if self._corner_preclick == self._generate_key(): self._corner_callback(event.xdata, event.ydata) self._corner_preclick = None which only uses public APIs from upstream. What is the purpose of this code? It looks like this is a de-bouncer to cancel a callback if something changes the limits while the mouse is held down? Tom On Fri, Feb 15, 2019 at 3:52 AM PICCA Frederic-Emmanuel < frederic-emmanuel.picca at synchrotron-soleil.fr> wrote: > Hello, > > I have this code in one of the project I neded to update. > Since we are targetting Debian buster, I need to support > matplotlib 2.X (python2) AND matplotlib 3.X (python3) > > > class HiddenToolbar(NavigationToolbar2QT): > def __init__(self, corner_callback, canvas): > super(HiddenToolbar, self).__init__(canvas, None) > self._corner_callback = corner_callback > self.zoom() > > def press(self, event): > self._corner_preclick = self._views() > > def release(self, event): > if self._corner_preclick == self._views(): > self._corner_callback(event.xdata, event.ydata) > self._corner_preclick = None > > > > The problem, I have is with the _views() method. > The 3.X version, complains that it is not available in the > NavigationToolbar2QT. > > so I would like to know how to rewrite this in order to be 2.X and 3.X > compatible. > I tryed to find some information in the documentation about this but I did > not find it. > > thanks for your help. > > Frederic > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic-emmanuel.picca at synchrotron-soleil.fr Sat Feb 16 03:44:11 2019 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Sat, 16 Feb 2019 08:44:11 +0000 Subject: [Matplotlib-users] Migrating some code which use NavigationToolbar2QT to matplotlib 2.x AND 3.x In-Reply-To: References: , Message-ID: > Fedric, > Hello from NSLS-II! :)) > `_veiws` is private so we reserve the right to change it at any time. `.views()` was a Stack of lists of the xlim and ylim of all of the Axes in the Figure. I suggest replacing it > with something like thanks a lot. I did not know that matplotlib guyes where working at NSLS-II. > ... > which only uses public APIs from upstream. I prefer also. > What is the purpose of this code? It looks like this is a de-bouncer to cancel a callback if something changes the limits while the mouse is held down? I do not know for now, but I will tell you if I discover it :). This is some code from binoculars that I need to migrates. to matplotlib 3.X. Cheers Fred From tcaswell at gmail.com Mon Feb 18 17:09:05 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 18 Feb 2019 17:09:05 -0500 Subject: [Matplotlib-users] 2019 John Hunter Excellence in Plotting Contest Organizers Message-ID: Folks, We need a volunteer or two to help run the JHEPC competition this year (Nelle Varoquaux and Michael Droettboom ran it last year) The role involves : - making sure the announcement goes out - collecting a panel of judges (starting from last years) - organizing the collection of the submissions - sending the judging packet out to the judges and collecting the results - collating the results from the judges The timeline is: - get announcement out (late March / Early April) - collect submissions and distribute to judges (late May / early June) - final tally of results (July 10-12 to be announced at SciPy) The time commitment is 10-20 hours total between now and July. Tom -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndbecker2 at gmail.com Fri Feb 22 08:01:59 2019 From: ndbecker2 at gmail.com (Neal Becker) Date: Fri, 22 Feb 2019 08:01:59 -0500 Subject: [Matplotlib-users] equally spaced nice colors? Message-ID: I'm currently using seaborn to get equally spaced nice colors: import seaborn as sns colors = np.array(sns.color_palette("hls", len (solution))) Now that mpl has all new improved color models, do I still need to use sns or can I easily do something similar with mpl directly? From dawid.niezgodka at gmail.com Thu Feb 7 13:54:24 2019 From: dawid.niezgodka at gmail.com (=?utf-8?Q?Dawid_Niezg=C3=B3dka?=) Date: Thu, 07 Feb 2019 18:54:24 -0000 Subject: [Matplotlib-users] Pycharm matplotlib issue Message-ID: <6EC252F9-6A96-47F3-8204-872F7CE9E525@gmail.com> Good evening, working with the PyCharm IDE, I?ve encountered a following problem with matplotlib: AttributeError: module 'matplotlib' has no attribute ?artist?. Unfortunately, there are few documented solution out there in the internet. I?ve found suggestions to reinstall matplotlib (I did, to no avail) or to change an environment (same as before). Do you know any solution to this problem? I?d be grateful for your help. Best regards, Dawid From konstantin.miller at gmail.com Sun Feb 10 14:38:43 2019 From: konstantin.miller at gmail.com (Konstantin Miller) Date: Sun, 10 Feb 2019 19:38:43 -0000 Subject: [Matplotlib-users] Writing a custom Scale class Message-ID: Hi, I have a time series with two values x(t) and y(t), stored in a Pandas data frame df with columns DateTime, ValueX, ValueY. I would like to plot ValueY vs. ValueX. In addition, I would like to see for each data point on the graph the date when it was measured. My idea was to plot(ValueX, ValueY) and then somehow set the labels to DateTime. But not only the visible tick labels. Rather, when I move my mouse over the plot, I would like to see (DateTime, ValueY) for each point, rather then (ValueX, ValueY). Or, another way to see it is, that I would like to plot ValueY vs. DateTime, but scale the x-axis as ValueX. My take was to plt.plot(df.index, df.ValueX), and to write a custom Scale module that receives the data frame upon construction and that scales the x-axis as ValueX and formats the labels as DateTime. I managed to have the right scaling of my x-axis but I can't see any ticks nor tick labels. And when I hover the mouse over the plot, I see (x=nan, y=). I appreciate any help! :) It seems that the documentation for such low-level functionality is sometimes a bit scarce :) Here is a minimum working example: import matplotlib.scale import matplotlib.transforms import matplotlib.pyplot as plt from matplotlib.ticker import AutoLocator, FixedLocator, FuncFormatter, MaxNLocator, ScalarFormatter import numpy as np from numpy import ma import pandas as pd class Scaler(matplotlib.scale.ScaleBase): name = 'scaler' def __init__(self, axis, df, **kwargs): matplotlib.scale.ScaleBase.__init__(self) self.df = df def get_transform(self): return self.Transform(self.df) def limit_range_for_scale(self, vmin, vmax, minpos): min_ = max(vmin, self.df.index.min()) max_ = min(vmax, self.df.index.max()) return min_, max_ def set_default_locators_and_formatters(self, axis): axis.set_major_locator(AutoLocator()) axis.set_major_formatter(ScalarFormatter()) class Transform(matplotlib.transforms.Transform): input_dims = 1 output_dims = 1 is_separable = True has_inverse = True def __init__(self, df): matplotlib.transforms.Transform.__init__(self) self.df = df def transform_non_affine(self, x): if x.ndim > 1: assert x.ndim == 2 and x.shape[1] == 1 y = ma.masked_array(np.zeros_like(x), mask=[False for _ in x]) for i in range(x.shape[0]): if x.ndim == 1: if (int(x[i]) != x[i]) or (x[i] not in df.index): y.mask[i] = True else: y[i] = self.df.at[int(x[i]), 'x'] else: if (int(x[i, 0]) != x[i, 0]) or (x[i, 0] not in df.index): y.mask[i] = True else: y[i, 0] = self.df.at[int(x[i, 0]), 'x'] return y def inverted(self): return Scaler.InvertedTransform(self.df) class InvertedTransform(matplotlib.transforms.Transform): input_dims = 1 output_dims = 1 is_separable = True has_inverse = True def __init__(self, df): matplotlib.transforms.Transform.__init__(self) self.df = df def transform_non_affine(self, x): if x.ndim > 1: assert x.ndim == 2 and x.shape[1] == 1 y = ma.masked_array(np.zeros_like(x), mask=[False for _ in x]) for i in range(x.shape[0]): if x.ndim == 1: if x[i] not in df['x']: y.mask[i] = True else: y[i] = self.df.loc[self.df['x'] == x[i], :].index[0] else: if x[i, 0] not in df['x']: y.mask[i] = True else: y[i, 0] = self.df.loc[self.df['x'] == x[i, 0], :].index[0] return y def inverted(self): return Scaler.Transform(self.df) matplotlib.scale.register_scale(Scaler) df = pd.DataFrame(index=range(1, 11), data={'x': [1, 1.5, 3, 3.5, 5, 5.5, 7, 7.5, 9, 9.5], 'y': range(1, 11)}) fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.plot(df.index, df['y']) ax.set_xlim([df.index[0], df.index[-1]]) ax.set_xscale('scaler', df=df) Cheers Konstantin -- To send me an encrypted email, download my public key from pgp.mit.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: