Comments (6)
pandoc-pyplot version 2.1.5.0 now supports two additional parameters, in the global config-file only: tight_bbox: true|false
and transparent: true|false
. See the updated README for instructions.
I didn't add those parameters for individual figures, but if you want that, don't hesitate to re-open this issue!
from pandoc-pyplot.
Hey @seldridge ,
That's a good idea. Initially, that's why I had the DPI option.
What you can do right now
Add the bbox_inches="tight"
option to pandoc-pyplot
plots by using a preamble of the following kind:
style.py
:
import matplotlib.pyplot as plt
plt.rcParams['savefig.bbox']='tight' # Sets the default value in plt.savefig(...)
In your Markdown/Latex:
{.pyplot include=style.py}
...
You can do that with most arguments to plt.savefig
, e.g. facecolor
, edgecolor
, figsize
, etc. See here for a guide to Matplotlib customization.
In the future
I can see two paths forward:
- Allow arbitrary arguments as a string that is directly passed to
plt.savefig
; - Add relevant parameters to the Haskell interface, like
dpi
right now.
Looking at all the supported arguments in the latest Matplotlib release, there are a lot of potential that might never be used.
Beyond bbox_inches
, are there any other savefig parameters you want to change?
from pandoc-pyplot.
Thank you for your kind words as well.
from pandoc-pyplot.
Ah, cool! rcParams
does the trick. Thanks for the pointer to Matplotlib customization. (I had gone ahead and locally, crudely patched the saveFig
call to always use my bbox_inches
parameter.) I guess I'm torn as this approach is really sufficient and future-proof for API changes to saveFig
...
Of your future ideas, I'd prefer (2) just because there's some notion of type safety as opposed to passing a string directly to saveFig
.
Of the available parameters, I only use bbox_inches
and Transparent
.
from pandoc-pyplot.
I can see why you would want to use the transparent
parameter often, especially on the web. I've often had to use bbox_inches
for more advanced plots as well. I will add both right now.
from pandoc-pyplot.
Fix looks great, thanks!
from pandoc-pyplot.
Related Issues (9)
- An error breaks the installation of pandoc-pyplot HOT 3
- Error in $: Failed reading: not a valid json value HOT 3
- Limited to matplotlib HOT 18
- Support for interactive Plotly figures when possible
- [FEATURE REQUEST]: Include multiple scripts HOT 3
- [FEATURE REQUEST]: configuration and include scripts in YAML metadata block HOT 2
- [FEATURE REQUEST]: store state between executions of blocks HOT 2
- Problem with pandoc 2.8 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandoc-pyplot.