pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
http://pgfplots.sourceforge.net/
200 stars 35 forks source link

Scaling pgf but not font #333

Closed pgf-tikz-bot closed 4 years ago

pgf-tikz-bot commented 7 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/support-requests/15/ Author: apf35 Timestamp: 2017-06-06 14:29:41.880000

https://sourceforge.net/p/pgfplots/support-requests/15/attachment/mwe.tex Hello, I must first say thanks to the developers for this package. I do not know if it was intended first to create and save vector plots via matplotlib under python, but this is how I use it now.

I am struggling with the following issue : I have saved my plots with no preferred figsize, as I wanted the plots to be flexible and to adapt to any size constraint. My problem is the following : How can I rescale a .pgf file without changing the font size? I have tried many many solutions.

What I do for the moment is the following : if I want to have 2 plots side-by-side, I create two minipages, inside of which I use rescalebox in order to force the pgfplot to scale to the size of the minipage. Sadly, my plots are a bit too complicated for tikz (I have tried with the package matplotlib2tikz). It distorts the picture and makes it look ugly. The backend is not exactly the same than pgf/matplotlib.

Despite all my research, I could not find any solution. Could you help? Thanks so much in advance, Best

pgf-tikz-bot commented 7 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/support-requests/15/#cd30 Author: apf35 Timestamp: 2017-06-06 14:31:27.429000

https://sourceforge.net/p/pgfplots/support-requests/_discuss/thread/eadc5b35/cd30/attachment/cryst_50.pgf Let me also provide the two /pgf files that I would like to use

pgf-tikz-bot commented 7 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/support-requests/15/#ee1a Author: apf35 Timestamp: 2017-06-06 14:33:03.915000

https://sourceforge.net/p/pgfplots/support-requests/_discuss/thread/eadc5b35/ee1a/attachment/cryst_3560.pgf ...and here is the second one.

Very sorry about the triple post! I did not find the option to attache multiple files Sorry, and thanks again!

pgf-tikz-bot commented 7 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/support-requests/15/#545c Author: cfeuersaenger Timestamp: 2017-06-06 15:53:51.578000

Thanks for your request!

PGF offers coordinate transformations, especially scaling which might be of help here. I believe that PGF's scaling should not affect the font size.

However, scaling is specified in terms of a number of sorts "scale=1.3" which is somewhat awkward if you want to have a prescribed width.

I suggest that you read pgfmanual.pdf, especially the sections about \pgftransformscale . Make sure that you apply the standard scaling, not "canvas coordinate transformations". I admit that I do not know for sure if this is possible without problems in your case; might require some experiments.

Aside from that, you are right: PGF has not really been written to become the backend of a 3rd party tool, although it is quite good at it. However, it looses much of its flexibility and own size control.

Note that I have to close this support request since it has nothing at all to do with pgfplots. Pgfplots might be an alternative to matplotlib in the first place, but that is not what you asked for. I suggest that you strip down the example such that it contains just the lines needed to demonstrate the problem and ask for help at https://tex.stackexchange.com/. The guys there have a lot of experience, are willing to help and are fast as well. Much faster as if you post the support request at https://sourceforge.net/projects/pgf/.

pgf-tikz-bot commented 7 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/support-requests/15/#9e33 Author: cfeuersaenger Timestamp: 2017-06-06 15:54:04.229000