How do I format the x-axis on Python Ggplot? - python-ggplot

I need to format dates on a x-axis ggplot for python bar chart.
How can I do it?

Use scale_x_date() to format dates on the x-axis.
p = ggplot(aes(x='date'), data) + geom_bar() + scale_x_date(labels='%m-%Y')
This gives number of month and the year, for example, 01-1990
You can try other formats.

Related

Formatting logic app expression for DateTime

I am generating a file for export with the file name utcnow in the logic app expression which returns a value like this
utcNow()- "2020-06-01T15:41:15.5103915Z"
I want to convert it like "20200601154151" that means I need to remove some characters like" -","T" and millisecondsfollwed by Z,
I tried few combination of string format and I am not getting it right hoping you guys to help me.
Thanks,
There are many options for custom date formats. Here is a simple guide:
yyyy = Year (2020)
MM = Month (06)
dd = Day (01)
HH = Hour (15)
mm = Minute (41)
ss = Second (15)
Construct a format string (ex: yyyyMMddHHmmss) based on your requirements and pass it to formatDateTime:
formatDateTime(utcNow(), 'yyyyMMddHHmmss')
The resulting value will be '20200601154115'. There are many additional options at the link above.

AM charts plots on the wong position

Am charts plots lines some lines on the wrong y-axis position. see code and snapshot bellow.
My graphs:
[{"bullet":"none","labelsEnabled":false,"dashLength":0,"lineThickness":3,"title":[["Tonnes Milled"]],"valueField":"TonnesMilled","balloonText":"[[value]]","valueAxis":"LeftAxis","numberFormatter":{"precision":2,"decimalSeparator":".","thousandsSeparator":","},"lineColorField":"Color"},{"bullet":"none","labelsEnabled":false,"dashLength":0,"lineThickness":3,"title":[["Total Magalies Water PPM"]],"valueField":"TotalMagaliesWaterPPM","balloonText":"[[value]]","valueAxis":"LeftAxis","numberFormatter":{"precision":2,"decimalSeparator":".","thousandsSeparator":","},"lineColorField":"Color"},{"bullet":"none","labelsEnabled":false,"dashLength":0,"lineThickness":3,"title":[["Water Average Daily Consumption"]],"valueField":"WaterAverageDailyConsumption","balloonText":"[[value]]","valueAxis":"LeftAxis","numberFormatter":{"precision":2,"decimalSeparator":".","thousandsSeparator":","},"lineColorField":"Color"},{"bullet":"none","labelsEnabled":false,"dashLength":0,"lineThickness":3,"title":[["Water Consumption M3/ton"]],"valueField":"WaterConsumptionM3Ton","balloonText":"[[value]]","valueAxis":"LeftAxis","numberFormatter":{"precision":2,"decimalSeparator":".","thousandsSeparator":","},"lineColorField":"Color"}]
My data:
[{"TotalMagaliesWaterPPM":236458,"WaterAverageDailyConsumption":7627.677419354839,"WaterConsumptionM3Ton":0,"Date":"Jan - 2019","TonnesMilled":0,"DateConverted":true},{"TotalMagaliesWaterPPM":236459,"WaterAverageDailyConsumption":8444.964285714286,"WaterConsumptionM3Ton":0,"Date":"Feb - 2019","TonnesMilled":0,"DateConverted":true},{"TotalMagaliesWaterPPM":236460,"WaterAverageDailyConsumption":7627.741935483871,"WaterConsumptionM3Ton":0,"Date":"Mar - 2019","TonnesMilled":0,"DateConverted":true},{"TotalMagaliesWaterPPM":236461,"WaterAverageDailyConsumption":7882.033333333334,"WaterConsumptionM3Ton":0,"Date":"Apr - 2019","TonnesMilled":0,"DateConverted":true},{"TotalMagaliesWaterPPM":236462,"WaterAverageDailyConsumption":7627.806451612903,"WaterConsumptionM3Ton":0,"Date":"May - 2019","TonnesMilled":0,"DateConverted":true}]
Pay attention to the blue lines mostly:
Sample:
Another Sample:
Problem is your date format. You try to give your dates MMM - YYYY format, but chart do not know this and and render all of them as Jan 2019. Check this:
Formatting dates on category axis | amCharts3

How to align the xGrid lines with data points?

I have this chart: https://playground.anychart.com/5dBO9eg9/1
I would like the xGrid lines to start where the dates (2018-04-01, 2018-05-01, ...) are, so that they intersect the points on the chart.
Anybody has an idea on how to do this?
To achieve that, you need to use a DateTime scale instead of an ordinal one. And then to set the ticks interval as one month to show all the dates. Please find the playground sample in the comment below.

How to display only few intervals in x-axis while having more data using line jfreechart

I created a linechart using jfreechart and my dataset is as follows...
Date d = s.getUpdateDate();
String date = DATE_FORMAT.format(d);
lineDataset.addValue(s.getCount(), s.getAutomationName(), date);
I got a chart with count values and wrt grouping of date and automationName.
I want to display data for 365 days(which means 365 dates) in X-axis and in that case once the chart is generated i dont want all the dates to be displayed in the X-axis. In that case i need only 12 intervals to be displayed one for each month.
I need the interval to get modified so that all dates should not be displayed in x-axis.
Looking forward for your suggestions :)
Thanks in advance
I have domain axis intervals for all 365 days. It is not possible all of them in the chart. So I wanted to display only few intervals like 1 per month resulting in 12 intervals displaying in domain axis.
I came to know about timeseries chart and it automatically does it based upon chart width.
Thanks moeTi.

SSRS Gantt Chart - Change to date format

As per attached image, i have dates running along the X axis that starts on the 1st Jan 2012 and then increases monthly.
My problem is the format is displaying the month/day/year and I want day/month/year.
I have looked at Horizontal Axis Properties and under 'Number' but Date does not seem to be there.
Does anyone have any suggestions on changing the format.
Use 'Custom' and supply a date formatting string such as dd/MM/yyyy will give 01/09/2010 for example.

Resources