I want set a minimum value for a Flot graph, but if a value is available beyond the minimum value it should auto-scale.
There's no built-in way to do this.
You'll need to loop through your points before plotting, and if any of them exceed your minimum value, then don't provide the axis min.
Related
I have a contiguous set of numbers up to a maximum (1...y). Im trying to find in which increment (defined by another value x) a given number (z) falls within that set.
Below is an image that best describes what I'm trying to find.
Is there a formula I can use with the available information to achieve this?
n = ceil(z*x/y);
In your example, the size of the range is divisible by the number of bins, so that all bins have equal size. If that condition does not hold then there may be some further questions about edge cases.
I've been learning about flow graphs and from what I've learned, a flow graph is a directed, weighted graph that has a certain maximum flow that can be calculated. However, is there a way to randomly weight the graph with values between a certain range and gradually change the weights to maximize the max flow?
If you change the weights of the edges then it's possible that the max flow value change. I mean, the max flow value is for a graph, if you change the graph the max flow value will change too.
Ask yourself about what do you persuit whenever changing weights of edges. If you want to maximize max flow value and you have to choose weights for a certain range then by choosing the maximum value of the range as weight of all edges you will surely find the highest max flow value obtained by modification of weights in a certain range.
I am trying to write a R-Script that saves a series of Maps with Dots on it. For the Map I used ggmap and geom_point for the Dots. There is a map for each day in a certain time range.
The size of the Dots depends on a certain variable, but I have a problem scaling them. I am supposed to create later an animation of all the maps changing the dots' size through time, that means that I need a global scale for the dimension of the dots, spacing from the smallest value (zero) to the biggest value of that variable (the global maximum). In the most maps the biggest value is not reached.
I tried with:
scale_size_area(max_size = max(my_variable))
because scale_size_area allows to plot very tiny dots for the 0 values. I was hoping that the so written code would scale the dots correctly, using the global maximum as maximum size, but it doesn't seem to work. Every map has still a locally biggest dot that has the same size of any biggest dot in every map. Here's an example where two points with different values have the same size:
I hope I could explain my problem. I'd be glad to hear some suggestion.
To set the maximum and minimum values in a scale (size or otherwise), use limits:
scale_size_area(limits = c(NA, max(your_varible))
NA computes the minimum
it would be great to clarify how colors are calculated when ploting treemap (I use gvisTreeMap function from R googleVis library).
Documentation is not very informative. What is it meant by "The color value is first recomputed on a scale from minColorValue to maxColorValue"? Usually I use treemap to display sales (size) and sales difference (color). So ideally I would like to color rectangles so that I can distinguish positive from negative growth, which as I understand is not possible at the moment.
What bothers me most right now is that "... colors are valued relative to all other nodes in the graph". Is there any way to fix colors, so that sales difference, say -25 always gets the same color.
If I have understood your problem correctly, I believe the following will solve it:
Let's say your data is percentages, so can go from 0 to 100. Set minColorValue=-100 and maxColorValue=100
(Or if using a different range, just set it so that the min value is the negative of the max value so that the average is 0.)
Then, if you set the colours to, for example, minColor='red' and maxColor='green', this should solve part 1 (negative values will be displayed in red, and positive in green)
Also, it seems that setting maxColor and minColor fixes the average value the colors are calculated from, so that this also solves part 2 (that is, -25 will then always have the same color in the graph)
Color is computed as the average color value of all child nodes of a branch. A branch with no child nodes uses the color value from the DataTable. This color value is then scaled on the minColorValue to maxColorValue scale, and a color is computed between minColor and maxColor based on the scale.
Colors are not relative to other nodes on the graph - the size of the node is relative.
In Flex columnchart, the height depends on the value, when 2 values have much difference.
the smaller value is not very clearly shown on the axis. Is it possible to define the minimum height of column to show, so that even a very small value can be seen?
Typically, in any charting library you'll want to do this by controlling the vertical axis. For example, consider the following data
Foo | Bar | Baz
0.7 | 30 | 80
If you were to chart this and let flex automatically calculate the vertical axis and it chooses for the vertical axis to go from 0.7 to 80 then Foo will barely show up.
However, if you were allowed to specify the vertical axis then you could programatically choose good axis values. For example, let maximumValue be the (previously calculated) maximum value of your data and let minimumValue be the (previously calculated) minimum value of your data. Then you can set your axis min and max as follows...
axisMinimum = minimumValue - ((maximumValue - minimumValue) * 0.2)
axisMaximum = maximumValue + ((maximumValue - minimumValue) * 0.2)
This would ensure that the smallest value in your chart appears at the 20% (0.2) position in your chart and the maximum value appears at the 80% (1-0.2) position of your chart. You can play with the multipliers to get a chart that looks good to you.
The only disadvantage you'll find is that when charts are very close in value then this will make them seem even closer.