ZedGraph XAxis on top of the graph rectangle - zedgraph

Is there a way to position the XAxis of the ZedGraph on top of the graph and use IsReverse on the scale of the YAxis so that my graph looks like below
Y
X 0 1 2 3 4 5
1
2
3
4
5
Should I achieve this using X2 axis? I do not know how to add it if there is an X2Axis.
I have searched a lot and could not find an answer. Just wanted to make sure it is not possible before I switch to microsoft chart.
Thanks.

You can achieve that using x2 axis by doing the following:
GraphPane.X2Axis.IsVisible = true;
GraphPane.XAxis.IsVisible = false;
GraphPane.YAxis.Scale.IsReverse = true;

Related

Removing every 2nd xtick label only works for the first 6 ticks

I have a simple line graph, but the xticks are overlapping. Therefore I want to display only every 2nd xtick. I implemented this answer which worked for me in another graph. As you can see below it stops working after the 6th tick and I can't wrap my head around why.
My code is the following:
data = pf.cum_perc
fig, ax = plt.subplots(figsize=(10, 6))
ax.set_xlabel("Days", size=18)
ax.set_ylabel("Share of reviews", size = 18)
for label in ax.xaxis.get_ticklabels()[1::2]:
label.set_visible(False)
ax.plot(data)
pf.cum_perc is a column of a data frame (therefore a series) with the following data:
1 0.037599
2 0.089759
3 0.203477
4 0.302451
5 0.398169
6 0.486392
7 0.533514
8 0.538183
9 0.539411
10 0.550040
11 0.550716
12 0.553050
13 0.553726
14 0.654789
15 0.681084
16 0.706211
17 0.731462
18 0.756712
19 0.781594
20 0.807766
21 0.873687
(and so on)
The resulting graph:
Any help is greatly appreciated :)
As user #ImportanceOfBeingErnest suggested:
Solution 1:
Convert the x-axis data to numbers, so matplotbib takes care of the ticks automatically. In my case this is done by
pf.index = pf.index.map(int)
Solution 2:
Remove the ticks, after the graph is plotted, otherwise the objects don't exist yet and therefore can't be set invisible.
The new code would look like this:
data = pf.cum_perc
fig, ax = plt.subplots(figsize=(10, 6))
ax.set_xlabel("Days", size=18)
ax.set_ylabel("Share of reviews", size = 18)
ax.plot(data)
for label in ax.xaxis.get_ticklabels()[1::2]:
label.set_visible(False)

Establish Itext table width using SetWidthPercentage method in VB net

I have a table which I need to fill 100% of the whole page. This is the code I used:
....
Dim tamanyo_tabla As New Rectangle(PageSize.A4)
Dim dimensiones_tabla(11) As Single
dimensiones_tabla(0) = 3
dimensiones_tabla(1) = 3
dimensiones_tabla(2) = 10
dimensiones_tabla(3) = 10
dimensiones_tabla(4) = 10
dimensiones_tabla(5) = 8.33
dimensiones_tabla(6) = 8.33
dimensiones_tabla(7) = 12.5
dimensiones_tabla(8) = 8.33
dimensiones_tabla(9) = 8.33
dimensiones_tabla(10) = 6
dimensiones_tabla(11) = 12.18
table_sem.SetWidthPercentage(dimensiones_tabla, tamanyo_tabla)
....
If you sum all the figures from the array dimensiones_tabla you will notice its 100%.
I based this on this example(it has no updates, eventhough the method has changed): http://itextpdf.com/examples/iia.php?id=79
I open the pdf and I found the table width is far from being 100% of the page.
You are setting the width percentage like this:
table_sem.SetWidthPercentage(dimensiones_tabla, tamanyo_tabla)
The total of all the widths in dimensiones_tabla is 100 user units (1.3889 inch). The width of tamanyo_tabla is 595 user units. Hence you are defining a width percentage of 100 / 595 = 16.8%. 16.8% is indeed far from being 100% of the page.
If you want the table to take 100% of the available width of the page, why don't you just set the width percentage to 100%?
table_sem.setWidthPercentage(100); // Java!
In VB, this would probably look like this:
table_sem.WidthPercentage = 100 // VB
Note that this will not be 100% of the total page, because you probably have a left and a right margin that is greater than 0. If you want the table to cover the complete page width, you need to set the left and right margin to 0.

VB2010 Setting logarithmic scale intervals

I'm developing a financial application in which I need to display data in a chart with a logarithmic scale on the Y axis. Everything works fine except for the intervals. With the following:
chart.ChartAreas(0).AxisY.IsLogarithmic = True
chart.ChartAreas(0).AxisY.LogarithmBase = 10
chart.ChartAreas(0).AxisY.Interval = 1
chart.ChartAreas(0).AxisY.Minimum = CalcMinYVal(minYVal)
I get the CalcMinYVal multiplied by 10^0,10^1,10^2,10^3 and so on for the Y-axis values.
I would like to have the Y axis values increased by 1. How can I have the interval be REALLY 1?
You can enable the MinorGrid property
chart.ChartAreas(0).AxisY.MinorGrid = True
to show the horizontal lines in between the powers of 10 like shown below.
But there is a limitation in showing the value for each subdivision. They can only appear in fixed intervals by using the Interval property of the LabelStyle.
For example to show 10 subdivisions, you can set:
Chart.ChartAreas(0).AxisY.LabelStyle.Interval = 0.1
The number of the horizontal lines of the MinorGrid can be controlled by using its Interval propery:
Chart.ChartAreas(0).AxisY.MinorGrid.Interval = 1
and the values of the labels can be rounded by using the format property:
Chart.ChartAreas(0).AxisY.LabelStyle.Format = "{0.0}"

gnuplot to plot histogram with lines

I've two column data as:
9 17.52
11 29.77
7 62.75
11 36.15
7 30.46
7 52.5
9 65.26
9 90.05
14 101.87
12 86.88
15 74.78
And want that first column be plotted as histogram according to index of y2, and second column be plotted as line according to index of y1. Anyone has ideas?
Maybe I didn't understand your question correctly, but are you possibly looking for something like this:
set style fill solid border -1
set boxwidth 0.4
plot "Data.dat" u 2 w boxes t "boxes", "" u (column(0)):1 t "lines" w l
?

GNUPLOT: dot plot with data depending dot size

I am trying plot data sets consisting of 3 coordinates:
X-coordinate, x-coordinate and the number of occurrences.
example:
1 2 10
3 1 2
3 2 1
I would like to draw for every line a dot at x,y with a diameter which is depending on the third value.
Is that possible with Gnuplot?
Create a 2D plot with variable point size. See the demo.
Example:
plot 'dataFile.dat' u 1:2:3 w points lt 1 pt 10 ps variable
This is basically equivalent to the existing answer, just shorter:
plot 'dataFile.dat' with circles
Credit: Gnuplot: plot with circles of a defined radius