Coder Social home page Coder Social logo

plawt's Issues

Subplot titles: 'subtitledict' doesn't behave as expected.

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.

add support for animations

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)

add support for subplots

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

refactor to use matplotlib's object-oriented api

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.