I am using plotItem to plot a graph and cross hair feature to display the coordinates using mouse point. But the coordinates are appearing flipped with respect to the x-axis. I want to rotate the text by 180 deg w.r.t x-axis.
I am putting that line here.
""label.setText(" x=%0.1f , y=%0.1f" % (mousePoint.x(), mousePoint.y())""
Thanks
Related
I am migrating from gnuplot to R plotting.
In gnuplot when a 3d is rotated the front and back of the view line up, making the appearance of 2d plot.
In plot3d() the back plane appears narrower than the front plane of the view. So , it appears like there is a distance view (tunnel vision).
R plot3d showing narrowing of view:
gnuplot showing a 3d rotated so the front and back are one:
In my plot3d() the xyz axis are all set to 30 - a cube.
The question becomes: does plot3d() have way to not have a narrowing of the perspective ?
If the answer is 'no' - OK.
If the answer is 'yes' - just point me to a link or the documentation.
I suspect you are looking for an isometric perspective; try par3d(FOV=0). From ?par3d:
‘FOV’ real. The field of view, from 0 to 179 degrees. This
controls the degree of parallax in the perspective view.
Isometric perspective corresponds to ‘FOV = 0’.
I would like to blend two images, one is smaller and is completely enclosed by the larger one, Assume the both are rectangular. I would like to blend these two so that there is a smooth transition in a rectangular band around the smaller image. I am trying to do this in MATLAB.
For example here two images are shown on top of each other, orange and black mages:
I would like to create a transition band around the orange image such that at the very outward boundaries of the band the alpha map for the orange image has a value of 0 and for very inward boundaries have value of 1 and there is a smooth transition from 0 to one inside the gray band that is shown below:
I am looking for a map for the gray area probably a 2-D matrix that has values between 0 and 1. Is there any equation based or ready made such matrix?
I know I can create a simple linear transition for a vertical or horizontal band for example if the X shows the x-coordinate of the left most edge of the inner image and my blending width is W then I can use this:
alpha(x) = (x-X)/W for X<x<X+W
1 for x > X+W
But how to create such an alpha in 2-D?
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
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!
I am trying to learn XNA by writing a small 2D game, it's a Top-Down perspective and Im trying to have double movement, moving along the axis using Left-Right and Up-Down keys, as well as looking right at the mouse cursor, so that the player can run and aim at the same time.
I have one vector for the player position (m_PlayerPos), and one vector for the mouse position (m_MousePos), and im trying to get the correct angle towards the mouse position.
Im using the formula method:
public static float Angle(Vector2 from, Vector2 to)
{
return (float)Math.Atan2(from.X - to.X, from.Y - to.Y);
}
This works, but for some reason the method only works half-way, along the x-axis. When the mouse is to the exact left of right of the player, the player looks right at the mouse.
But if I move to the top of the player, it looks down, and if the mouse is below the player, the player looks up. So I need to inverse the Y axis, but Im not sure how.
Thanks in advance for any feedback.
Use to.Y - from.Y.
Multiply it with (0.0, -1.0) (or just multiply the Y component by -1.0). This will mirror the vector along the horizontal axis and should achieve the result you want.
In screen space the origin is in the top-left corner with the Y axis pointing downward whereas in eucledean space the Y axis points upwards. That's why you observe the Y axis being "flipped".