mef51 / plawt Goto Github PK
View Code? Open in Web Editor NEWJSON-like sugar for matplotlib
License: MIT License
JSON-like sugar for matplotlib
License: MIT License
setting 'grid' to false still shows grid.
easy fix
plawt's 'subtitledict' becomes the fontdict
for matplotlib's [axes.set_title](https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.set_title.html)
.
Only the 'verticalalignment' field of fontdict
has the intended effect, and with inconsistently as well (you have to put 'center' when you mean 'bottom').
I think this is a matplotlib issue and not a plawt issue.
I can currently make animations using plawt
and imageio
like this (for example):
animation = {
'ylabel': 'z/H', 'xlabel': 'r/H',
'ylim': (-2, 10), 'xlim': (-6, 6),
'figsize': (6/1.3, 6.5/1.3),
'title': 'Likely how W4 expanded',
'show': False,
'keepOpen': True,
'legend': {'loc':4}
}
y = np.arange(0.01, 2.05, 0.05)
with imageio.get_writer('blast.gif', mode='I', fps=24) as writer:
for i, t in enumerate(tqdm(y)):
animation[0] = {'x': np.concatenate((r(z, y[i]), -r(z, y[i]))), 'y': np.concatenate((z,z)),
'line':'k-', 'label':'$y=$'+str(y[i])}
plt = plawt.plot(animation)
fig = plt.gcf()
fig.canvas.draw()
data = fig.canvas.tostring_rgb()
row, col = fig.canvas.get_width_height()
image = np.fromstring(data, dtype=np.uint8).reshape(col, row, 3)
writer.append_data(image)
plt.close()
But I want to abstract some of the details away.
The method above is essentialy generating bitmap as frames and putting them together, but matplotlib
has its own api for animating using functions which might be more efficient. I'll need to look into that and maybe support both ways of animating. (http://matplotlib.org/api/animation_api.html#animation)
I want to be able to specify sizes of figures in pixels using plawt..
see answer here:
https://stackoverflow.com/questions/13714454/specifying-and-saving-a-figure-with-exact-size-in-pixels
the interface could be something like
plawt.plot([{
0: {'x': x, 'y': y},
'xlabel': 'some label',
'filename': 'plot.png'
}, {
0: {'x': x2, 'y': y2},
'xlabel': 'some other label'
}])
That is, pass mutliple 'plot' dictionaries and inherit global properties like title or filename from the first plot dictionary as a convention
right now things internally are done by importing pyplot
and then calling things like plt.plot()
, plt.xlabel()
, etc... this is not great because i have to do weird if/else branches if for example only an x
axis is provided and the call signature to plt.plot()
is different. (also i got bashed on reddit for doing it this way and i kinda agree)
matplotlib
has an api where you can do things like axis.xlabel = 'blah blah'
and i think this might be a cleaner and more extensible way to have plawt
work. But I don't really know this api and I need to look into it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.