Y-axis scale with ZedGraph - zedgraph

I don't understand this axis scaling. I'm able to set the max/min by
changing GraphPane.Y2Axis.Scale.Min/Max.
However, this decouples the bars from the scale. The bars are at the exact same place as before, even though the scale change. So obviously, they are not related anymore.
If I set the max/min, I obviously want the bars to be zoomed in the y direction, but this doesn't happen.
What am I doing wrong?

The solution is to set the property IsY2Axis to True.

Related

(How) can a matplotlib figure be made to respond to "zoom" navigation in one dimension only?

Matlab has a useful zoom mode triggered by zoom xon or zoom yon whereby you can click-and-drag with the mouse to zoom in on data, but with only one dimension (x or y, respectively) changing. Instead of an elastic box, the cursor changed into an elastic I-beam that allowed you to set the beginning and end of the range quite precisely.
Is there any way of getting a matplotlib figure to do the same thing? Playing with the toolbar, and briefly looking into the code behind it, I only see a "zoom rect" mode.
I'm aware that you can approximate this effect by right-clicking-and-dragging in "pan" mode, while trying to ensure that your hand only moves in one dimension, but that can be quite frustratingly imprecise. If there were a zoom xon equivalent, I would gladly use that instead.
The interactive navigation lists among its shortcuts
Constrain pan/zoom to x axis: hold x when panning/zooming with mouse
Constrain pan/zoom to y axis: hold y when panning/zooming with mouse

Core Plot Charts Axis Position

I'm using core plot 1.0. Currently I'm making the X axis draw say 20 points above the bottom of the screen (so the labels can show up) by defining the Y range a little bit below 0.
Now I was asked that the origin point should be 0.0 and there should not be anything below 0 in both axes, so I'm now looking at the core plot documentation and scratching my head with the following question:
What property do I need to set to move the axes at the position I'd like to and also keep on showing the point labels and axis titles?
Thanks a lot!
I've found it so I leave it here for if somebody else needs help with this.
It is kind of tricky, you need to adjust the xRange and yRange on the plot space so it's big enough to draw the labels, the ticks and the titles and then adjust the visibleRange property on each axis. At this point you get the amount of axis you want and still displaying the information you need.
If someone knows a better way please share :)

How do I pad a graph so that lines aren't clipped by the edges?

I've had a pretty good look around for an answer to this, and tried several solutions in my code, nothing found so far.
I have a line graph that I am plotting, a CPTScatterPlot graph, and I have got points adding to it correctly. I want to show each of these points as a dot about 3-5 pixels in diameter, and connected by lines that are about 3 pixels wide. This all works fine.
The problem is that when the plot is a straight along one of the edges of the graph hosting view, the lines and dots are clipped and don't look right at all.
This is a mockup of what it should look like:
And this is the effect I am seeing much of the time at the moment:
I apologise for the small images, but hopefully you can see that in the second one, the line and dots are rendered only a few pixels into the graph view, not fully in view. In the second one the data is actually at y=1 for the first 75%, then falls down to y=0.
How can I inset the drawing of the graph components by several pixels to prevent the clipping of any shapes?
So far:
I have tried setting the padding on the graph, but that just
contracts the area it draws to, I suppose to make room for titles
which I am not using.
I have also tried adding to the min/max x/y range settings which I
recalculate based on the data I am updating in the background. This
works, but obviously only if the amount I add to those values is
correct in relation to the drawing scale that will be used for the
data values I am inputting.
I am on Mac OS using NSView (actually CPTGraphHostingView) so clipsToBounds isn't available. Also, I tried masksToBounds and masksToBorder on CPTXYGraph.
I think the easiest way to handle this is to simply extend your ranges by a small amount. There is a method in CPTPlotRange that makes it very easy to extend a given range by a fixed percentage (e.g. 1%). I think the main test app example even shows this in action.
Another option would be to turn off the masksToBounds and/or masksToBorder on the CPTPlotArea (plotArea) and possibly the CPTPlotAreaFrame (plotAreaFrame). You access them both via properties of the graph.
This might be of help..
The default padding on the graph itself (not the plot area frame) is 20 pixels on each side. You can change that, too.
graph.paddingLeft = 0.0;
graph.paddingTop = 0.0;
graph.paddingRight = 0.0;
graph.paddingBottom = 0.0;

Proper rotation with changing x/y coordinates

I'm trying to make a little archer game, and the problem I'm having has to do with 2 pixels in particular, I'll call them _arm and _arrow. When a real archer is pulling back an arrow, he doesn't immediately pull the arrow back as far as his strength allows him, the arrow takes a little bit of time to be pulled back.
The _arm's angle is equal to the vector from a point to where the user touched on the screen. The rotation is perfect, so the _arm is good. The _arrow needs to be on the same line as _arrow, they are 1 pixel wide each so it looks as though the _arrow is exactly on top of the _arm.
I tried to decrement from the x/y coordinates based on a variable that changes with time, and I set the _arrow's location equal to the _arm's location, and tried to make it look like the _arrow was being pulled back. however, if you rotated, the x/y would mess up because it is not proportional on the x and y axis, so basically _arrow will either be slightly above the arm or slightly below it depending on the angle of the vector, based on touch.
How could I used the x/y position of _arm and the vector of touch to make the arrow appear as though it was being pulled back by a small amount, yet keep the arrow on top of the _arm sprite so that it's position would be similar to the arm, but slightly off yet still on top of the _arm pixel at all times. If you need anymore info, just leave a comment.
I'm not sure I've fully understood, but I'll have a go at answering anyway:
To make the arrow move and rotate to the same place as the consider adding the arrow as a child of the arm. You can still render it behind if you like by making its z is less than one: [arm addChild:arrow z:-1]
To then make the arrow move away from the arm as the bow is drawn, you then just set the position of the arrow with respect to the arm.
The problem I do see with this solution however is that this grouping of the sprites may be a little unusual after the arrow leaves the bow. Here you probably don't want the arrow to be a child of the arm as the coordinate systems are no longer related.
Even though they're sure what I "suggested would have solved [the] problem" here is the
Poster's solution
I had to get the x and y coords of the arm based of angle, then I got the sin/cos of a number that was based of the same angle as the arm and subtraced from that.

How to move a Core Plot graph

I have a Core-Plot Graph within a Mac Application. But the inside table is appearing shifted down and to the left of the containing "frame/border" so that neither of the axis' are showing. I cannot figure out how to change this does anyone know what parameters I need to change to fix this?
Update: Sorry I did not realize I could upload an image, I have done so know and will try your suggestions in the mean-time.
Not sure what you mean by "inside table". It would be easier to offer suggestions if you could post a screenshot.
Without seeing what's wrong, here are some common areas to look at:
If you haven't already done so, look at the example apps included with Core Plot for ideas. The Plot Gallery app has many sample plots and the others are useful, too.
You may need to add padding (paddingLeft, paddingBottom, etc.) on the graph and/or plot area frame. Padding the graph pushes everything in away from the edges of the graph. Padding the plot area frame pushes the plot area in so the axes and titles can hang outside the plot area (the area where the plots are drawn).
If you want to keep an axes pinned to a specific place, e.g., the edge of the graph, set up a floating axis. Otherwise make sure the orthogonal coordinate is set (it defaults to 0). For example, the orthogonal coordinate for the x-axis is the y-value where the x-axis crosses the y-axis.