I did charts in Sage and there I can choose aspect ratio:
The aspect ratio describes the apparently height/width ratio of a unit square. If you want the vertical units to be as big as the horizontal units, specify an aspect ratio of 1.
show(circle((1,1), 1) + plot(x^2, (x,0,5)), aspect_ratio=1)
Now I am using google app engine and googles charts. I can't figure out how to set aspect ratio there. For example, shape1 and shape 2 are both [-1;1] X and [-1;1] Y. But on the screen it looks like rectangle because I set "width: 600, height: 400".
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('number', 'X');
data.addColumn('number', 'Shape 1');
data.addColumn('number', 'Shape 2');
for (var i = 0; i < 500; ++i) {
data.addRow([Math.sin(i / 5) * 0.25, Math.cos(i / 25), null])
}
for (var i = 0; i < 500; i++) {
data.addRow([Math.sin(i / 25), null, Math.cos(i / 10) * 0.5]);
}
// Create and draw the visualization.
var chart = new google.visualization.ScatterChart(
document.getElementById('visualization'));
chart.draw(data, {title: 'Cool shapes',
width: 600, height: 400,
vAxis: {title: "Y", titleTextStyle: {color: "green"}},
hAxis: {title: "X", titleTextStyle: {color: "green"}}}
);
}
A solution that worked for me is to specify width
and height
to be equal and then explicitly specifying the hAxis.minValue
, hAxis.maxValue
and vAxis.minValue
, vAxis.maxValue
. I compute the xspan and yspan of my data, choose the maximum of the two and them calculate the hAxis and vAxis min/max values accordingly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.