tshead2 on main
Bump version number. (compare)
tshead2 on v1.0.1
tshead2 on main
Update our compatibility statem… Toyplot version 1.0.1 (compare)
tshead2 on main
Additional fixes to sync with c… (compare)
tshead2 on main
Begin testing with Python 3.10. (compare)
tshead2 on main
Makes toyplot work with python … Merge pull request #202 from St… (compare)
tshead2 on main
Begin exploring graphcat and xm… (compare)
tshead2 on main
Bump version number. (compare)
tshead2 on v1.0.0
tshead2 on main
Toyplot version 1.0.0 (compare)
tshead2 on main
Add missing modules to the docu… (compare)
tshead2 on main
We don't need to combine parall… (compare)
tshead2 on main
Temporarily disable Eades graph… (compare)
tshead2 on main
Do a DOM comparison for HTML ar… (compare)
tshead2 on main
Add missing CI dependency. (compare)
Hello~ I'm doing a object detection project and want to use Toyplot for visualization when training. The code I tried so far is:
import numpy as np
import toyplot
import toyplot.svg
from skimage.data import astronaut
img = astronaut()
w, h = img.shape[:2]
canvas = toyplot.Canvas(width=w, height=h)
mark = canvas.image(img, rect=(0, 0, w, h))
axes = canvas.cartesian(show=False, margin=0, padding=0)
bbox = np.float32([
[22, 33, 44, 55],
]) # x1, x2, y1, y2
mark = axes.rects(bbox[:, 0], bbox[:, 1], bbox[:, 2], bbox[:, 3], style={
'stroke': 'orange',
'stroke-width': 2,
'fill-opacity': 0.0
})
toyplot.svg.render(canvas, './vis.svg')
However, the result seems incorrect. I expect a small rectangle but got a rectangle same size as the image. Are there any problem in the code? Or are there any other way to overlay bounding boxes on an image?
After tracing code, I found a solution. We need to specify xmin
, xmax
, ymin
, ymax
of cartesian
to make cartesian.project
work which is used by here. So
# Note the inversion of y-axis
axes = canvas.cartesian(show=False, margin=0, padding=0, xmin=0, xmax=w, ymin=h, ymax=0)
gets the desired result!
toyplot.graph
but using latter is more logical.Toyplot and Python 2
Gang:
Just a reminder that Python 2 will no longer be maintained after January 1, 2020 (https://pythonclock.org), and Toyplot is one of a large number of scientific projects that are ending support for Python 2 prior to that date (https://python3statement.org). So here’s what to expect over the next few weeks:
FWIW, I’ve been doing virtually all of my Toyplot development on Python 3 for over a year, without complaint. You should consider doing the same with your work. It’s time. Don’t panic.
Cheers,
Tim
@amoshyc asked:
Are there any chance to make Toyplot able to add raw svg element directly?
Sorry I overlooked this. We don’t support embedding directly, because it would complicate support for non-SVG backends. However, you can do this pretty easily as a postprocessing step. See the documentation for
… in either case, you can get the output as a DOM tree, suitable for further manipulation. The structure of the DOM is pretty clean, and there are CSS classes you can use to anchor queries.
hannes
is https://toyplot.readthedocs.io/en/stable/tick-locators.html#explicit-locators the "proper" way of labeling categories in a bar chart? my x axis is categorical
hannes
i would like to render some bigger matrix
If you find that you’re doing it a lot, you can also do
import toyplot.config
toyplot.config.autoformat = “png”
to make it the default (at the top of your notebook, say).
hannes
i often want to use data from dictionaries with toyplot, eg .keys() as x and .items() as y axes. unfortunately this leads to "TypeError: float() argument must be a string or a number, not 'dict_keys'" from https://toyplot.readthedocs.io/en/stable/_modules/toyplot/require.html#scalar_array because numpy's conversion to an array does not like python's dict views or iterators
hannes
i can wrap it into a list() call but that seems ugly
hannes
no idea why numpy does not support those but i wonder if adding some logic to toyplot's scalar_array function would make sense for this usecase?
hannes
```
hannes
Example of what I would love to use (in an explicite way):import toyplot
data = {1: 5, 2: 3, 3: 4}
canvas = toyplot.Canvas()
axes = canvas.cartesian()
mark = axes.plot(
data.keys(),
data.values(),
)
hannes
https://toyplot.readthedocs.io/en/stable/tutorial.html#scatterplots uses a shared x axis for a stacked plot, is there a way to make a "true" scatterplot of irregular data?
hannes
i have unique x and y axes for each series
hannes
just use the default until it does not do what you need
hannes
posted an image: hannes
hm, when using matplotlib, one can get an image in there from a script itself by calling plt.show()
hannes
i guess that is a super magic command
hannes
sad how bad the state of relaying between messaging services still is :(