Plotting bar chart from spark.sql results - apache-spark

I am new to data analysis. Please help me on how to plot a bar chart from this sql result. I am using google colab
AttacksDF=spark.sql("select TRIM(ATTACK_CAT), count(*) as numattacks from UNSWNBTb group by TRIM(ATTACK_CAT) ORDER BY TRIM(ATTACK_CAT)").show()
I am failing to find a solution maybe it's my limited knowledge

Related

How to display graph in excel with the percentage data

I am creating one graph in excel to show all my concluded data in the consolidated graph format. I tried multiple logic but unable to do generate graph.
Could you please suggest me solution for graph with below data:
I created the graph, but for that I have to add specific value instead of margin value.

Plot non time series data in grafana

I installed the Cassandra source data for Grafana with the help of this link https://github.com/HadesArchitect/GrafanaCassandraDatasource/wiki/Quick-Demo.
The data that I have in Cassandra is not a time series data. Is there any way to plot some charts without a timestamp column?
Bar chart panel is designed for non timeseries (categorical data): https://grafana.com/docs/grafana/latest/visualizations/bar-chart/

Dynamic date query in Power Query

I'm fairly new to power pivot / query / BI so please excuse my lack of understanding.
Summary of what I'm doing
I have access to an OLAP cube which I am choosing to connect to via Power Pivot Data Model in Excel.
In the Table Import Wizard, I am able to produce what I need from the cube and develop in the Power Model using fixed date ranges. However, this requires me to come back in and alter the date ranges for a number of reasons.
I now want to limit my data dynamically based on a date filter.
I want to do this in the query to limit my model size.
I am working in the "Table Import Wizard" shown below
Snapshot of where I am working, note filter expression
Question:
Am I correct that to achieve this I write an MDX expression? If I add the [Received Date.Day] as a dimension, and change the operator to MDX, it is my understanding I can write an expression to dynamically filter the dataset? When the user refreshes the query they will only get that last 91 days of data based on the received date.
Essentially something like this (excuse my syntax as I have no idea what is required in this platform so I am just relating it to an SQL type syntax):
SELECT Item_Code, Received_Amount
FROM Purchasing_Cube
WHERE Received_Date > = Today()-91
Thanks in advance for any assistance.

Excel, how to make a graph with different steps than those you've used in your table?

Ok, I'm having troubles here.
I'd like to make a graph from this table:
The problem is that I don't want the graph to use the scale I used in my table, since my scale is completely unusable. My graph looks like this:
I want to make Excel ignore my scale, and use steps like 1 mL for the horizontal axis. I'm using Excel 2010.
This what I get when I select the dataset and insert an XY Scatter:
(which seems a bit more like a pH curve IMO!)
Now, you can change the axis setting by right clicking on it:
You might also want to use some gridlines to help reading the graph, which you can insert via:
You need to use an XY / Scatter chart type

Add Custom labels (from a data coloumn series) to bar graph in GNUPlot

I am trying to plot a bar graphs representing the energy values of each amino acid in a protein. Here I am sharing the sample data as image below and actual data.
See Data and Sample Graph Image I need here.
Now, I want to plot a graph looking something like this using GNUPlot. in which I can have custom labels for each bar from respective Protein*Label series columns.
See image here
For preparing this graph I used MS Office with "XY CHART Label" Addin, But It involves too much manual interference, and I have to prepare hundreds of plots like this. So I think GNUPlot (or something else) will be a good option which allow me the automation.

Resources