I have a horizontal bar chart where I decided to hide the Y axis and display the axis labels inside the chart:
Now I'd like to know how I can tell Dimple to use the free space (see red rectangle) available from hiding the Y axis.
You set the bounds of the plot area with setMargins or setBounds. Dimple doesn't automatically size to accommodate axes. So just set the left margin to about 10px.
Related
I have a data set “mydatainR”
With that I created a barplot and when I download the barplot, part of the y axis is cut off because it’s “off of the paper”
I want to give myself more room to work with, or make my entire bar plot smaller. Thx
I have a chart that has strings for its x axis (a list of names). It's linked to a dynamic array, I have a problem where the graph resizes itself and squeezes 14-15 strings from the array and makes the bar chart small and tiny.
How can I achieve chunky bars and a scroll bar to scroll down to see the rest of the data even when new values are being added to the x-axis at runtime.
Have spent an hour searching with no help! =[
Edit:
Setting the PixelPointWidth Property to 300 gave me the width of the bar the way I want to be, but it has bunched the bars so that all the bars of the 4 series are overlapping instead of being side by side. WHere to go from here?
Edit2:
Manipulating the charts height is definitely getting the desired results, the only thing is the bigger the height, the more white space at the top of the chart, whats the fix for that,. and a fix for the Series representations to be "frozen" on scroll.
You can set the width of the chart every time you add new data to it:
Dim barWidth = Double.Parse(Chart1.Series(0)("PixelPointWidth"))
Chart1.Width = CInt(nData * barWidth) + 100
where nData is how many points there are and the 100 is some amount to take into account the space needed for the Y-axis labels and the legend.
Place the chart control in a Panel as suggested by jmcilhinney with AutoScroll set to true, and you will get a scrollbar when the width of the chart exceeds the width of the panel.
If you want the chart to show the latest added data, you can set the horizontal scroll position after setting the width of the chart:
Panel1.HorizontalScroll.Value = Panel1.HorizontalScroll.Maximum
I'm making plots where the (0,0) position is not necessarily in the bottom left corner of the plot frame, meaning that the x and y axes and their ticks cross within the plot frame. It's fine to have the lines, ticks and their values within the frame, but having the axis titles so near to their lines interferes with visualization of certain data points.
I'd simply like to force the x and y axis titles to be at the bottom and far left of the plot frame, respectively; it doesn't work to simply 'pad' the xlabel or ylabel titles because the padding I'd need would vary between plots.
How to get the titles always in these consistent locations of the plot frame, even if the corresponding axis lines, ticks/values may vary in the plot frame space?
Thank you.
I'd like to add a note here. It seemed to me that it could be possible to define the xlabel and ylabel 'labelpad' values directly from the data range:
For example, one could find the minimum x-value of the minimum y-value (this would set the position of the x-axis label), and the minimum x-value of the minimum x-value (this would set the position of the y-axis label):
xpad = ax.get_ylim()[0]
ypad = ax.get_xlim()[0]
Then use these values in xlabel and ylabel parameters as labelpads:
pylab.xlabel("X Title", fontsize=12, labelpad=abs(xpad))
pylab.ylabel("Y Title", fontsize=12, labelpad=abs(ypad))
Unfortunately, it doesn't look like labelpad can accept variables. Any suggestions that might allow a work-around?
I'd like to have one axis label centered over two axes in matplotlib.
For example, I set up the axes as follows:
figure = pyplot.figure(figsize=10,10))
diagram1 = figure.add_axes([0.01,0.62,0.90,0.30])
diagram2 = figure.add_axes([0.01,0.32,0.90,0.30])
This will generate two diagrams on top of each other. How can i now define one axis label for the y axis centered on both diagrams.
I think this can be done with subplots, but I prefer to set every diagram individually, as shown above.
You can manually change the y-coordinate of the label.
diagram1.set_ylabel('y label').set_y(0)
# Alternatively you can use
# diagram2.set_ylabel('y label').set_y(1)
The coordinate is in the axes coordinate space, meaning 0 is the bottom and 1 is the top of the Axes.
Seeing how your Axes are placed at x=0.01, you can make the label appear at the right side of the plots as well
diagram1.yaxis.set_label_position("right")
After setting the bar offset , the axis labels are not displaying at the center of the bar and getting misplaced. Can any one help me with this ??
The barOffset moves the centers of the bars away from the bar locations provided by the datasource. If the axis labels are at the bar locations, they won't line up with the bars.
Possible solutions:
Set the barOffset to zero (0).
Change the axis labeling policy to place the labels under the bars. This will also move any tick marks on the axis unless you make custom labels.