MayaVi: Label axes with "wrong" scale - scale

Can I have a different scale on my axes than in my plot?
I'm displaying an image in mayavi, and then graphing some 3D shapes around it. All my measurements are related to the size of the image (ie in pixels) so that things are in the right relative positions.
But the image is of the Milky Way, and I want to label the axes in distance units (kpc) instead of pixels. Basically, I need to label the axes in pixels and then divide all the values by 20 to get kpc. Is that possible?
Thanks!

Related

Scale an SVG object along a user-defined axis in Illustrator

I have an object (see orange arc below) within an SVG that I would like to scale along the axis of the object itself.
I know the "Transform" options in Illustrator allow you to scale along the X or Y axis, but that doesn't work for me. I want to scale the object such that at each cross-section of the arc (depicted as the black lines in the photo), the object is exactly 10% of the width of the original. Therefore, the axis that I want to scale along is the hypothetical curved line which passes perpendicularly through all of the black lines in the photo.
If done correctly, this should reduce the X and Y dimensions of the object only slightly, but will reduce the orange-colored area to be 10% of the original.

What should I use for the diameter of the camera rotation around an object

I am using graphics.py to make 3D graphics. Yes I know it is stupid and super difficult but that is what makes it fun. Anyways, I use the center of the screen as the origin point to rotate the camera around and use the window height and width to determine the diameter of the radius that you can go around. When I do this and the window height is different than the width, I get 2 different sized circles for rotating around the X axis and the Y axis. What should I do to get the circles the same size.
Current math:
RadiusY = winHeight/2
RadiusX = winWidth/2
RadiusZ = (RadiusX+RadiusY)/2

How to modify the scale of x and y axes of image pixel plot object from spatstat package in R

I have this image pixel object, created using Spatstat package in R. The range of x-axis is [0,24], the range of y-axis is [28000, 29500]. When I plot it out in R studio, the graph looks very narrow as below:
I guess it is because the range of x-axis is too small compared to y's. What should I do to make the plot wider?
In the spatstat package, spatial objects are always plotted isometrically. The plot uses the same physical scale for the x and y axes.
Spatial objects in spatstat occupy a specific location and size in two-dimensional space. A pixel image (object of class "im") is associated with a rectangular region at a specific location in two-dimensional space with a specific width and height. If this region is long and thin, then the plotted image will be displayed as long and thin, and will not be rescaled to fit the screen or page.
If you want to stretch a pixel image in spatstat, you need to transform it to another image, which will be defined on a different region of two-dimensional space.
You can do that with the spatstat function affine. In your example, if Z is your original pixel image, you could do
A <- affine(Z, diag(c(60,1)))
The second argument is the transformation matrix, which in this case is just a stretch of the x axis by a factor of 60. (The transformation will stretch the domain of the image, and stretch each individual pixel, by a factor of 60 in the x direction. The number of pixels and the pixel values will be unchanged. No interpolation or other fudging will occur.)
See Chapters 3 and 4 in the spatstat book

can gnuplot point the z axis to left or right?

I am new to gnuplot, and am using it to draw 3d plots. I would expect gnuplot should be able to orient the xyz coordinate system in any orientation, but that doesn't seem to be the case. The z axis appears constrained to be in a vertical plane perpendicular the screen of my monitor. In other words, I cannot get the z axis to point at all to the left or right. Is this possible, and if so how is it done? I will try to include an image of a 3d plot made with Mathcad that shows what I mean.enter image description here

how to scale a Bezier curve (using HTML5 canvas)?

I have a Bezier path stored as an array of several points, which is each an array of coordinates in the form [cp1x,cp1y,cp2x,cp2y,x,y].
I'd like to be able to scale this path up and down to adjust its size, but I don't know the math to do that. I tried applying a coefficient to each of the coordinate values, but that didn't seem to work.
Does anybody know how to achieve this?
In the standard representation, the points P, represent actual points in space, so you'd move them around like any other points. That is to scale them, just multiple everything by you scaling factor: say it's a, so that would be [a*cp1x,a*cp1y,a*cp2x,a*cp2y,a*x,a*y], or if you want to scale x and y separately, you can use different factors for the x and y components.
Note also that this will scale things relative to the origin (x=0, y=0), so if you don't have any curves at the origin, it can look like a shift. If you want to negate the effect of this shift you can subtract Px and Py from the x and y values respectively, where Px and Py is the point you want to not move when scaled, before you do the scaling (and then add it back after you multiple, if you want to). But if what you want to do is scale an entire canvas, like going from 5x5 inch to 7x7, you'd want to do the multiplication without any shifts (and in this case, by 7./5).

Resources