From ndbecker2 at gmail.com Fri Oct 2 09:21:37 2020 From: ndbecker2 at gmail.com (Neal Becker) Date: Fri, 2 Oct 2020 09:21:37 -0400 Subject: [Matplotlib-users] Simplifying plots (reducing data points)? Message-ID: I produced a line plot as: ax.plot (x, y, '.') and saved as pdf. Both x and y were large vectors, resulting in a large pdf, and when incorporated into a LaTeX document, the resulting pdf takes a long time to open. Other than my manually decimating the vectors: ax.plot (x[::100], y[::100], '.') Is there some way within mpl to simplify plots? Or perhaps post-processing the pdf? Thanks, Neal -- *Those who don't understand recursion are doomed to repeat it* -------------- next part -------------- An HTML attachment was scrubbed... URL: From fiolj at yahoo.com Fri Oct 2 09:40:19 2020 From: fiolj at yahoo.com (fiolj) Date: Fri, 2 Oct 2020 10:40:19 -0300 Subject: [Matplotlib-users] Simplifying plots (reducing data points)? In-Reply-To: References: Message-ID: <8aeb637e-7cbb-5816-0a53-d071c5313826@yahoo.com> I don't know if it is acceptable to you, but may be producing a png file would be an option (latex would accept it). Regards, Juan El 10/2/20 a las 10:21 AM, Neal Becker escribi?: > I produced a line plot as: > ax.plot (x, y, '.') > and saved as pdf. > > Both x and y were large vectors, resulting in a large pdf, and when > incorporated into a LaTeX document, the resulting pdf takes a long time > to open. > > Other than my manually decimating the vectors: > ax.plot (x[::100], y[::100], '.') > > Is there some way within mpl to simplify plots?? Or perhaps > post-processing the pdf? > > Thanks, > Neal > > -- > /Those who don't understand recursion are doomed to repeat it/ > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From ndbecker2 at gmail.com Fri Oct 2 09:51:18 2020 From: ndbecker2 at gmail.com (Neal Becker) Date: Fri, 2 Oct 2020 09:51:18 -0400 Subject: [Matplotlib-users] Simplifying plots (reducing data points)? In-Reply-To: <8aeb637e-7cbb-5816-0a53-d071c5313826@yahoo.com> References: <8aeb637e-7cbb-5816-0a53-d071c5313826@yahoo.com> Message-ID: Yes, I considered this. But to produce publication quality documents I've learned to avoid bitmap graphics. On Fri, Oct 2, 2020 at 9:40 AM fiolj wrote: > I don't know if it is acceptable to you, but may be producing a png file > would be an option (latex would accept it). > Regards, > Juan > > El 10/2/20 a las 10:21 AM, Neal Becker escribi?: > > I produced a line plot as: > > ax.plot (x, y, '.') > > and saved as pdf. > > > > Both x and y were large vectors, resulting in a large pdf, and when > > incorporated into a LaTeX document, the resulting pdf takes a long time > > to open. > > > > Other than my manually decimating the vectors: > > ax.plot (x[::100], y[::100], '.') > > > > Is there some way within mpl to simplify plots? Or perhaps > > post-processing the pdf? > > > > Thanks, > > Neal > > > > -- > > /Those who don't understand recursion are doomed to repeat it/ > > > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > > -- *Those who don't understand recursion are doomed to repeat it* -------------- next part -------------- An HTML attachment was scrubbed... URL: From flyamer at gmail.com Fri Oct 2 10:05:29 2020 From: flyamer at gmail.com (Ilya Flyamer) Date: Fri, 2 Oct 2020 15:05:29 +0100 Subject: [Matplotlib-users] Simplifying plots (reducing data points)? In-Reply-To: References: <8aeb637e-7cbb-5816-0a53-d071c5313826@yahoo.com> Message-ID: How about rasterizing just the plot? plt.plot(x, y, rasterized=True) should work I think. ??, 2 ???. 2020 ?. ? 14:52, Neal Becker : > Yes, I considered this. But to produce publication quality documents I've > learned to avoid bitmap graphics. > > On Fri, Oct 2, 2020 at 9:40 AM fiolj wrote: > >> I don't know if it is acceptable to you, but may be producing a png file >> would be an option (latex would accept it). >> Regards, >> Juan >> >> El 10/2/20 a las 10:21 AM, Neal Becker escribi?: >> > I produced a line plot as: >> > ax.plot (x, y, '.') >> > and saved as pdf. >> > >> > Both x and y were large vectors, resulting in a large pdf, and when >> > incorporated into a LaTeX document, the resulting pdf takes a long time >> > to open. >> > >> > Other than my manually decimating the vectors: >> > ax.plot (x[::100], y[::100], '.') >> > >> > Is there some way within mpl to simplify plots? Or perhaps >> > post-processing the pdf? >> > >> > Thanks, >> > Neal >> > >> > -- >> > /Those who don't understand recursion are doomed to repeat it/ >> > >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Matplotlib-users at python.org >> > https://mail.python.org/mailman/listinfo/matplotlib-users >> > >> > > > -- > *Those who don't understand recursion are doomed to repeat it* > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Fri Oct 2 11:55:39 2020 From: pmhobson at gmail.com (Paul Hobson) Date: Fri, 2 Oct 2020 08:55:39 -0700 Subject: [Matplotlib-users] Simplifying plots (reducing data points)? In-Reply-To: References: Message-ID: Neal, Do you have line simplification turned on in your rcParams? https://matplotlib.org/3.3.2/tutorials/introductory/usage.html#line-segment-simplification -paul On Fri, Oct 2, 2020 at 6:22 AM Neal Becker wrote: > I produced a line plot as: > ax.plot (x, y, '.') > and saved as pdf. > > Both x and y were large vectors, resulting in a large pdf, and when > incorporated into a LaTeX document, the resulting pdf takes a long time to > open. > > Other than my manually decimating the vectors: > ax.plot (x[::100], y[::100], '.') > > Is there some way within mpl to simplify plots? Or perhaps > post-processing the pdf? > > Thanks, > Neal > > -- > *Those who don't understand recursion are doomed to repeat it* > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndbecker2 at gmail.com Fri Oct 2 12:33:32 2020 From: ndbecker2 at gmail.com (Neal Becker) Date: Fri, 2 Oct 2020 12:33:32 -0400 Subject: [Matplotlib-users] Simplifying plots (reducing data points)? In-Reply-To: References: Message-ID: I didn't change it from the default. Guess I could try changing 'path.simplify_threshold' On Fri, Oct 2, 2020 at 11:55 AM Paul Hobson wrote: > Neal, > > Do you have line simplification turned on in your rcParams? > > https://matplotlib.org/3.3.2/tutorials/introductory/usage.html#line-segment-simplification > -paul > > On Fri, Oct 2, 2020 at 6:22 AM Neal Becker wrote: > >> I produced a line plot as: >> ax.plot (x, y, '.') >> and saved as pdf. >> >> Both x and y were large vectors, resulting in a large pdf, and when >> incorporated into a LaTeX document, the resulting pdf takes a long time to >> open. >> >> Other than my manually decimating the vectors: >> ax.plot (x[::100], y[::100], '.') >> >> Is there some way within mpl to simplify plots? Or perhaps >> post-processing the pdf? >> >> Thanks, >> Neal >> >> -- >> *Those who don't understand recursion are doomed to repeat it* >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > -- *Those who don't understand recursion are doomed to repeat it* -------------- next part -------------- An HTML attachment was scrubbed... URL: From fiolj at yahoo.com Mon Oct 5 09:00:04 2020 From: fiolj at yahoo.com (fiolj) Date: Mon, 5 Oct 2020 10:00:04 -0300 Subject: [Matplotlib-users] large pdf files References: <0886ed29-48a2-be2f-78a1-2bbab870d0ab.ref@yahoo.com> Message-ID: <0886ed29-48a2-be2f-78a1-2bbab870d0ab@yahoo.com> Hi, checking on sizes of pdf files I noticed that in my system currently pdf output are at least 370k when similar plots previously were about 20k. I tested with an old figure (I do not matplotlib version but was created about May 2019) and the figure was 15409 bytes while the same figure with matplotlib version 3.2.2 has a size of 429110 bytes. I checked and this happens even plotting a few (ten) points with line, everything using default values. My user configuration file has not been modified but my system may have changed. I've found similar reports but regarding much older versions. Any ideas? Regards, Juan From t.appel17 at imperial.ac.uk Mon Oct 5 13:30:06 2020 From: t.appel17 at imperial.ac.uk (Appel, Thibaut) Date: Mon, 5 Oct 2020 17:30:06 +0000 Subject: [Matplotlib-users] large pdf files In-Reply-To: <8AA64D6D-F191-4D1D-8019-CAA048D73FD0@imperial.ac.uk> References: , <8AA64D6D-F191-4D1D-8019-CAA048D73FD0@imperial.ac.uk> Message-ID: <825CC60E-A86B-4CA8-B52D-751439A03159@imperial.ac.uk> If the output size of .pdf is your concern, I suggest you export your figure with matplotlib in .eps, and then use the command line tool ? epstopdf ? shipped with any LaTeX distribution. The .pdf backend of matplotlib is far from being optimized. I always observe a factor of size decrease between 10 and 100 (!) in the output .pdf after running epstopdf, instead of saving directly in pdf. Thibaut > From: fiolj > To: matplotlib-users > Subject: [Matplotlib-users] large pdf files > Message-ID: <0886ed29-48a2-be2f-78a1-2bbab870d0ab at yahoo.com> > Content-Type: text/plain; charset=windows-1252 > > Hi, checking on sizes of pdf files I noticed that in my system currently > pdf output are at least 370k when similar plots previously were about 20k. > > I tested with an old figure (I do not matplotlib version but was created > about May 2019) and the figure was 15409 bytes while the same figure > with matplotlib version 3.2.2 has a size of 429110 bytes. > I checked and this happens even plotting a few (ten) points with line, > everything using default values. > > My user configuration file has not been modified but my system may have > changed. > > I've found similar reports but regarding much older versions. > > Any ideas? > Regards, Juan From t.appel17 at imperial.ac.uk Mon Oct 5 13:22:51 2020 From: t.appel17 at imperial.ac.uk (Appel, Thibaut) Date: Mon, 5 Oct 2020 17:22:51 +0000 Subject: [Matplotlib-users] Matplotlib-users Digest, Vol 63, Issue 4 In-Reply-To: References: Message-ID: <8AA64D6D-F191-4D1D-8019-CAA048D73FD0@imperial.ac.uk> If the output size of .pdf is your concern, I suggest you export your figure with matplotlib in .eps, and then use the command line tool ? epstopdf ? shipped with any LaTeX distribution. The .pdf backend of matplotlib is far from being optimized. I always observe a factor of size decrease between 10 and 100 (!) in the output .pdf after running epstopdf, instead of saving directly in .pdf. Thibaut > On 5 Oct 2020, at 18:00, matplotlib-users-request at python.org wrote: > > ? > ******************* > This email originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. > If you trust the sender, add them to your safe senders list https://spam.ic.ac.uk/SpamConsole/Senders.aspx to disable email stamping for this address. > ******************* > Send Matplotlib-users mailing list submissions to > matplotlib-users at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/matplotlib-users > or, via email, send a message with subject or body 'help' to > matplotlib-users-request at python.org > > You can reach the person managing the list at > matplotlib-users-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Matplotlib-users digest..." > > > Today's Topics: > > 1. large pdf files (fiolj) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 5 Oct 2020 10:00:04 -0300 > From: fiolj > To: matplotlib-users > Subject: [Matplotlib-users] large pdf files > Message-ID: <0886ed29-48a2-be2f-78a1-2bbab870d0ab at yahoo.com> > Content-Type: text/plain; charset=windows-1252 > > Hi, checking on sizes of pdf files I noticed that in my system currently > pdf output are at least 370k when similar plots previously were about 20k. > > I tested with an old figure (I do not matplotlib version but was created > about May 2019) and the figure was 15409 bytes while the same figure > with matplotlib version 3.2.2 has a size of 429110 bytes. > I checked and this happens even plotting a few (ten) points with line, > everything using default values. > > My user configuration file has not been modified but my system may have > changed. > > I've found similar reports but regarding much older versions. > > Any ideas? > Regards, Juan > > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > ------------------------------ > > End of Matplotlib-users Digest, Vol 63, Issue 4 > *********************************************** From fiolj at yahoo.com Tue Oct 6 09:03:40 2020 From: fiolj at yahoo.com (fiolj) Date: Tue, 6 Oct 2020 10:03:40 -0300 Subject: [Matplotlib-users] large pdf files In-Reply-To: <825CC60E-A86B-4CA8-B52D-751439A03159@imperial.ac.uk> References: <8AA64D6D-F191-4D1D-8019-CAA048D73FD0@imperial.ac.uk> <825CC60E-A86B-4CA8-B52D-751439A03159@imperial.ac.uk> Message-ID: <233bb3ce-e452-0998-6243-eb5378715557@yahoo.com> Thanks Thibaut, using eps or other format is a good solution but I was wondering about the change on file size. Usually, at least in my experience in linux is that pdf export from matplotlib is very efficient. In particular, very simple files were exported to small files. I do not know what (if anything) changed from a few versions back to the current version in my system (3.2.2) that the minimum file size I can get now is about 370k. Regards, Juan El 10/5/20 a las 2:30 PM, Appel, Thibaut escribi?: > If the output size of .pdf is your concern, I suggest you export your figure with matplotlib in .eps, and then use the command line tool ? epstopdf ? shipped with any LaTeX distribution. > > The .pdf backend of matplotlib is far from being optimized. > > I always observe a factor of size decrease between 10 and 100 (!) in the output .pdf after running epstopdf, instead of saving directly in pdf. > > Thibaut > >> From: fiolj >> To: matplotlib-users >> Subject: [Matplotlib-users] large pdf files >> Message-ID: <0886ed29-48a2-be2f-78a1-2bbab870d0ab at yahoo.com> >> Content-Type: text/plain; charset=windows-1252 >> >> Hi, checking on sizes of pdf files I noticed that in my system currently >> pdf output are at least 370k when similar plots previously were about 20k. >> >> I tested with an old figure (I do not matplotlib version but was created >> about May 2019) and the figure was 15409 bytes while the same figure >> with matplotlib version 3.2.2 has a size of 429110 bytes. >> I checked and this happens even plotting a few (ten) points with line, >> everything using default values. >> >> My user configuration file has not been modified but my system may have >> changed. >> >> I've found similar reports but regarding much older versions. >> >> Any ideas? >> Regards, Juan From ndbecker2 at gmail.com Thu Oct 15 08:08:29 2020 From: ndbecker2 at gmail.com (Neal Becker) Date: Thu, 15 Oct 2020 08:08:29 -0400 Subject: [Matplotlib-users] controlling ticks Message-ID: I am plotting with semilogy. I am getting the tick labels as powers of 10, which is what I want. However, because the range of data is large, the tick labels are every 2 powers of 10, [10^-1, 10^-3 ...] What's the easiest way to change so that the tick labels are for each integer power of 10, [10^-1, 10^-2 ...]? -- *Those who don't understand recursion are doomed to repeat it* -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Thu Oct 15 13:58:25 2020 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 15 Oct 2020 13:58:25 -0400 Subject: [Matplotlib-users] controlling ticks In-Reply-To: References: Message-ID: Lifted from a comment Bruno Beltran made on gitter: https://gitter.im/matplotlib/matplotlib?at=5f888b74631a250ab26f179b ```python import matplotlib.pyplot as plt import numpy as np import matplotlib.ticker t = np.logspace(0, 4, 10) fig = plt.figure() ax = fig.add_subplot() ax.loglog(t, t**3) enough_ticks = matplotlib.ticker.LogLocator(numticks=15) ax.yaxis.set_major_locator(enough_ticks) ``` works, but you have to know how many ticks you want up front. There are enough knobs on both LogFormatter and LogLocator that this seems like something that should be configurable, but I don't know how off the top of my head (and a very quick look at the source did not have an obvious path). Tom On Thu, Oct 15, 2020 at 8:09 AM Neal Becker wrote: > I am plotting with semilogy. I am getting the tick labels as powers of > 10, which is what I want. However, because the range of data is large, > the tick > labels are every 2 powers of 10, [10^-1, 10^-3 ...] > > What's the easiest way to change so that the tick labels are for each > integer power of 10, [10^-1, 10^-2 ...]? > > -- > *Those who don't understand recursion are doomed to repeat it* > _______________________________________________ > 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 mathoscope at netcourrier.com Tue Oct 20 16:38:52 2020 From: mathoscope at netcourrier.com (Vincent Douce Mathoscope) Date: Tue, 20 Oct 2020 22:38:52 +0200 Subject: [Matplotlib-users] rotated axis Message-ID: hi i would like to create some graphics with the y-axis inclinated in any angle with the xaxis, for example 45?, 55? as i need it i dont find here : http://python-simple.com/python-matplotlib/configuration-axes.php https://matplotlib.org/3.1.1/api/axes_api.html anything in this direction any tipps ? Vincent -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathoscope at netcourrier.com Wed Oct 21 02:38:39 2020 From: mathoscope at netcourrier.com (Vincent Douce Mathoscope) Date: Wed, 21 Oct 2020 08:38:39 +0200 Subject: [Matplotlib-users] Fwd: rotated axis References: <4F3D37D4-57F5-4FCA-A7D5-ADA3D62ACD6E@netcourrier.com> Message-ID: thanks Bruno for your answer not exactly in your example, only the grid in inclinated in my need, also th axis would be inclinated something like this where B is (0,1) and C is (1,0) and A is (0,0) Vincent > Le 21 oct. 2020 ? 02:46, Bruno Beltran > a ?crit : > > Hi Vincent, > > Is this the kind of thing you are looking for? > > https://matplotlib.org/gallery/api/skewt.html > > Best, > > Bruno > > On Tue, Oct 20, 2020 at 2:15 PM Vincent Douce Mathoscope > wrote: > hi i would like to create some graphics with the y-axis inclinated in any angle with the xaxis, for example 45?, 55? as i need it > i dont find here : > http://python-simple.com/python-matplotlib/configuration-axes.php > https://matplotlib.org/3.1.1/api/axes_api.html > anything in this direction > any tipps ? > Vincent > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users ---- https://lemathoscope.com/ cours de maths postbac par visio ---- https://lemathoscope.com/ cours de maths postbac par visio -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Capture d?e?cran 2020-10-21 a? 08.37.01.png Type: image/png Size: 147682 bytes Desc: not available URL: From projetmbc at gmail.com Wed Oct 21 08:10:48 2020 From: projetmbc at gmail.com (Christophe BAL) Date: Wed, 21 Oct 2020 14:10:48 +0200 Subject: [Matplotlib-users] Fwd: rotated axis In-Reply-To: References: <4F3D37D4-57F5-4FCA-A7D5-ADA3D62ACD6E@netcourrier.com> Message-ID: <0627d2e4-50c2-f4d2-9dc7-ca3231707ce2@gmail.com> Hello. What your are looking for is an affine coordinate system. I don't think that matplotlib can do that directly as it is the case for Geogebra. You should try to do every thing by hand. This will be boring but not hard. Le 21/10/2020 ? 08:38, Vincent Douce Mathoscope a ?crit?: > > thanks Bruno for your answer > not exactly > in your example, only the grid in inclinated > in my need, also th axis would be inclinated > something like this where B is (0,1) and C is (1,0) and A is (0,0) > Vincent > >> Le 21 oct. 2020 ? 02:46, Bruno Beltran > > a ?crit : >> >> Hi Vincent, >> >> Is this the kind of thing you are looking for? >> >> https://matplotlib.org/gallery/api/skewt.html >> >> Best, >> >> Bruno >> >> On Tue, Oct 20, 2020 at 2:15 PM Vincent Douce Mathoscope >> > wrote: >> >> hi i would like to create some graphics with the y-axis >> inclinated in any angle with the xaxis, for example 45?, 55? as i >> need it >> i dont find here : >> http://python-simple.com/python-matplotlib/configuration-axes.php >> https://matplotlib.org/3.1.1/api/axes_api.html >> anything in this direction >> any tipps ? >> Vincent >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > > ---- > https://lemathoscope.com/ > cours de maths postbac par visio > > > ---- > https://lemathoscope.com/ > cours de maths postbac par visio > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users -- Math, algo et codage. Sans oublier la famille, l'amour et le sport. ;-) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Capture d?e?cran 2020-10-21 a? 08.37.01.png Type: image/png Size: 147682 bytes Desc: not available URL: