These are chat archives for sandialabs/toyplot

27th
Mar 2017
Mar 27 2017 02:49
@dereneaton - yep, this is a bug. The intent is that when you specify the coordinates of a set of axes - whether explicitly or through defaults, whether cartesian, numberline, or table - the area that you specify is the area where the data goes. In other words, ticks, labels, etc. are all outside that area. That’s happening correctly with cartesian axes (including your graph), but the table isn’t behaving properly - the size specified for the table currently includes all of the table cells, not just the body of the table. A matrix (which is a special case of a table) has four extra rows and four extra columns (two each for top, bottom, left, and right) set aside for labels, and that is throwing things off.
Mar 27 2017 03:26
Here’s some code that displays a matrix on-top-of some cartesian axes, not-that-you-would-do-that-in-real-life, just to show that everything lines-up properly:
``````
import numpy
import toyplot

# Create a canvas with explicit width and height
canvas_width = 400
canvas_height = 300
canvas = toyplot.Canvas(width=canvas_width, height=canvas_height)

# Display some cartesian axes with default positioning.
gutter = 50
axes = canvas.cartesian(gutter=gutter)

# Create some data to view as a matrix.
data = numpy.random.normal(size=(8, 8))

# Set matching bounds for a matrix (which is a table), which currently
# hard-codes the sizes of the extra rows and columns at 20px.  I can't
# defend this.
matrix_bounds = (
gutter - 40,
canvas_width - gutter + 40,
gutter - 40,
canvas_height - gutter + 40,
)
matrix = canvas.matrix(data, bounds=matrix_bounds, lshow=False, rshow=True)``````
I’ll make this priority for the next release. Cheers, Tim
Mar 27 2017 03:31
On an unrelated note, I see that all your screenshots are hosted at files.gitter.im ... how are you posting them? I can't seem to figure out how to post images in gitter aside from hosting them somewhere else and linking, which is annoying.
Deren Eaton
@dereneaton
Mar 27 2017 17:50
@tshead2 thanks, I'll keep an eye out for the update and keep my hack in place until then.
Deren Eaton
@dereneaton
Mar 27 2017 18:10
For the hosted images on gitter, I've just used the screen-shot functionality in ubuntu (which copies the image as .png to a clipboard) and then I paste it into gitter with ctrl-v. Gitter takes care of the rest by automatically uploading it somewhere, and voila, it appears.