Print only some labels along the x-axis in pChart 2.0 - pchart

I have a set of data that I show in my chart generated in pChart, like this:
The problem is that I want to print only some labels in the x-axis and show the last label in the last point, keeping the same appearance of the curve.
How can I do that?
There is a function that does this in pChart 1:
void setFixedScale($VMin,$VMax,$Divisions=5,$VXMin=0,$VXMin=0,$XDivisions=5)
Is there a similar function like it in pChart2 or anyway to achieve a similar display?

Set the points you do not want to show up on the axis as NULL.
From your above x-axis labels, you would do something like this if you wanted to show only the first and last labels, but still keep the graph plotted for the other unmarked points:
$MyData->addPoints(array("01-Nov", NULL, NULL, NULL, NULL, "25-Jan"),"Labels");

Related

Altair sorting Chart

I'm trying to plot the data of my DataFarme in a groupedChart and I want the columns to preserve the order I gave them before. The data looks as follows (its not all there but its in the same way organized)
dataframe
When I plot it I get the following Graph:
graph
So the months were sorted even though I specified not to sort in the chart. I used the following code:
chart2 = alt.Chart(melted).mark_bar().encode(
column=alt.Column('variable',sort=None),
x=alt.X('room',sort=None),
y=alt.Y('value'),
color='room',
tooltip= ['room', 'value']
)
Does anyone know how I could fix that?
You've already used sort=None, which is the correct way to make scales in a non-faceted chart reflect the input order.
The missing piece is that faceted charts share scales by default (See Scale and Guide Resolution), so each facet is being forced to share an order.
If you make the x scale resolution independent, then each facet should retain the input order:
chart2 = alt.Chart(melted).mark_bar().encode(
column=alt.Column('variable',sort=None),
x=alt.X('room',sort=None),
y=alt.Y('value'),
color='room',
tooltip= ['room', 'value']
).resolve_scale(x='independent')

PowerBI: Formatting totals on combined stacked bar & line graph

I have a visualization (below) that is a combination Stack bar and Line graph . I am trying to format the data labels for the line graph totals- so that they all hover above the stacked bar. This works(with default settings) for all of the dates except the first bar (see image below- highlighted in yellow). There appears to be no formatting options available for the data labels of the line graph to control the label position (unlike in the stacked bar).
Any suggestions on how to force the totals to always appear above the bars?
A simple example file is available here https://drive.google.com/file/d/1m4qicc5gv5fCmVPiBe2m6THuHGKjacnx/view?usp=sharing
Any suggestions appreciated.
Go to Format > Y-Axis > Show secondary and set it to the Off position and it should look like this:
What's happening is that your line and bars were on independent axes, which makes them align not how you intend.
PowerBI supports Total labels for stacked visuals:
You can now turn on total labels for your stacked bar/column, stacked area, and line and stacked column charts, allowing you to see the aggregates of your data at a glance

Customizing tick marks and labels on x-axis (Excel VBA)

I'm drawing a graph in Microsoft Excel and I'm just wondering if this is possible, and if it is, how to achieve it. I've attached an illustration below:
This is what I have >
regular
This is what I'm trying to do > (I did this in Paint to illustrate)
edited in paint
Can the y-axis to cross over the x-axis at 30, but the tick marks starts at 100 onwards? I also don't want any labeling or tick marks below 30.
Thank you.
You need to hide the default axis and build your own. In my example, I want the axis to start at 30 and end at 730, but have tick marks and labels at 100, 200, 300, etc.
I set up a data range with X values in one column of 100, 200, 300, ... 700, and Y values of zero in the next column.
Chart 1 is the original chart without anything added or removed. Chart 2 has the added series, shown as orange plus-sign markers. Chart 3 has data labels below these added points, showing the default Y values of zero (orange text). In Chart 4 I have formatted the labels so that they show the X values instead of the Y values. In Chart 5 I have changed the X axis scale so it starts at 30 and ends at 730. I have also hidden the axis labels, not by removing them, but my using a custom number format of " ", which preserves the margin below the axis to leave room for my custom data labels. Finally in Chart 6 I have formatted the plus sign markers to match the axis line and the data labels to match the other chart text. I have also formatted the Y axis with major tick marks that cross the axis.
First two are basic chart formatting - plenty of examples to be found via Google for those.
For the third one you can use a custom format for your axis labels. See for example:
http://www.officetooltips.com/excel_2016/tips/conditional_formatting_of_chart_axes.html
Your format could look something like this:
[White][<=30]General;[Black][>30]General
In VBA:
With ActiveSheet.ChartObjects(1).Chart.Axes(xlCategory)
.TickLabels.NumberFormat = "[White][<=30]General;[Black][>30]General"
End With

Reportlab LinePlot - how do I add a lineLegend...or label my lines?

I have a lineplot with 2 lines on it...they're two separate channels from the same data set. Would love to just label each one - the "labels" options are all about giving a number for each point on your plot, and that is simply not helpful.
Would love to know how to do any (really, all, but I just need to do one to be happy) of these:
plot each against its own y axis and be able to sensibly label that axis with units (and color the numbers to correspond to the data it correlates to)
put a legend on it. I can't figure out how to use lineLegend
just put any kind of (singular) label in the vicinity of the lines.

How to change text of y-axes on a matplotlib generated picture

The page is
"http://matplotlib.sourceforge.net/examples/pylab_examples/histogram_demo_extended.html"
Let's look at the y-axis, the numbers there do not make any sense, could we change it to something else that is meaningful?
Except the cumulative distribution plot, and the last one, the rest of the y-axes data show normalized histogram values with normed=1 keyword set (i.e., the are underneath the histogram equals to 1 as in the definition of a probability density function (PDF))
You can use yticks(), see this example.