Comments (2)
Should be pretty easy to add this. Almost positive matplitlib fig.save also accepts a size parameter. If not then we can just hijack te fig size from the theme right before the plot is rendered.
from ggpy.
So, here is the ggsave documentation from http://docs.ggplot2.org/0.9.3.1/ggsave.html
ggsave(filename = default_name(plot), plot = last_plot(), device = default_device(filename),
path = NULL, scale = 1, width = par("din")[1], height = par("din")[2], units = c("in",
"cm", "mm"), dpi = 300, limitsize = TRUE, ...)
and here is the one for savefig(...):
savefig(fname, dpi=None, facecolor='w', edgecolor='w',
orientation='portrait', papertype=None, format=None,
transparent=False, bbox_inches=None, pad_inches=0.1,
frameon=None)
So, what is possible from the ggsave parameter:
- filename: file name/filename of plot
- plot: plot to save, defaults to last plot displayed -> see below
- device: device to use, automatically extract from file name extension -> Would need a translation to
format
- path: path to save plot to (if you just want to set path and not filename)
- scale: scaling factor -> No idea
- width: width (defaults to the width of current plotting window) -> bbox_inches
- height: height (defaults to the height of current plotting window) -> bbox_inches
- units: units for width and height when either one is explicitly specified (in, cm, or mm) -> would need a translation into bbox_inches
- dpi: dpi to use for raster graphics
limitsize: when TRUE (the default), ggsave will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.
The only interesting thing I can see is the plot
argument: if there is a plot argument we would call __repr__()
on it an then save the last plt.gcf()
. But that would mean that __repr__()
would NOT print the plot in interactive mode.
So what would you say to the following proposal:
- add a 'draw_plot()' which would 1) set interactive to false 2) draw the plot 3) reset interactive to whatever the value was before
- change
__repr__()
to calldraw_plot()
(and afterwardsplt.show()
?)
from ggpy.
Related Issues (20)
- [Feature Request]: Plot directly onto a matplotlib axis HOT 1
- the numbers squeeze on the x-axis or y-axis
- Wrong code
- Is this project dead? HOT 16
- "metaclass conflict" error when using ggplot 0.6.8 with six 1.10.0+
- Import does not work with pandas 0.23.4
- unable to import in jupyter notebook HOT 5
- Warning received when using color aesthetic with geom_point
- Import issue in jupyter notebook
- AttributeError: module 'pandas' has no attribute 'tslib' HOT 35
- Can't facet on variable with more than 9 levels
- facet_grid fail with a category type
- facet_grid repeat x-axis
- pandas sort issue
- How about make it available with dfply?
- Link to an actively developed project called "plotnine" which provides ggplot functionality in python.
- ggplot installs for python3.9.1.0, but import ggplot gets error re pandas attribute tslib HOT 2
- plot multiple geoms on top of each other
- Looking for `ggplot` substitution HOT 2
- Questions about Copilot + Open Source Software Hierarchy
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 ggpy.