Increasing the size of deliverable diamond in PlantUML gantt chart? - gantt-chart

The following plantuml file: gantt.uml creates a gantt chart with increased thickness of the bars and an increased font, such that it is better legible if there are many items in the Gantt chart.
#startgantt
project starts the 2021/07-22
saturday are closed
sunday are closed
skinparam classFontSize 100
[<size:30>Document relevant studies - 0.2] as [0_2] lasts 10 days
[<size:30>Deliverable: Literature Study - 0.3] as [0_3] happens at [0_2]'s end
[<size:30>Overlapping Research Project - 1] as [1] lasts 11 days
[0_3] happens at [0_2]'s end
[1] starts at [0_2]'s end
[0_2] is colored in DarkOrchid
[1] is colored in Cyan
#endgantt
Yielding:
However, I've noticed the size of the black diamond that resembles a deliverable does not grow along. Hence, I would like to ask:
How can I increase the size of the black diamond that resembles a deliverable in the PlantUML gantt chart?

Gantt charts now have lots of style options.
#startgantt
project starts the 2021/07-22
saturday are closed
sunday are closed
<style>
ganttDiagram {
task {
FontName Helvetica
FontColor red
FontSize 18
FontStyle bold
BackGroundColor blue
LineColor yellow
}
milestone {
FontColor blue
FontSize 40
FontStyle italic
BackGroundColor yellow
LineColor red
}
}
</style>
[<size:30>Document relevant studies - 0.2] as [0_2] lasts 10 days
[<size:30>Deliverable: Literature Study - 0.3] as [0_3] happens at [0_2]'s end
[<size:30>Overlapping Research Project - 1] as [1] lasts 11 days
[0_3] happens at [0_2]'s end
[1] starts at [0_2]'s end
[0_2] is colored in DarkOrchid
[1] is colored in Cyan
#endgantt

Related

How to create an overlapping bar chart in gnuplot

I looked for an answer to this question but wasn't able to find one that exactly matched with my particular problem.
First of all, I am using gnuplot (since I haven't found this answer also using Julia...)
The issue:
I have a file (test.dat) which is basically an array. It has 100 rows and 50 columns. Each row represents a bar chart that I need to plot. IN each column of that row, there is the value or magnitude of the bar. Simple.
So I need to plot all rows (a total of 100 bar charts) in the same graph. Also, I need it to be with transparency, so I can see all the bar-charts.
Can anybody help me with this problem?
You use this to set transparency:
set style fill transparent solid 0.5
0.5 is the level of transparency.
But if I understood the question correctly, your data format may be problematic. With the following data:
1 10 50
2 20 40
3 30 30
4 40 20
5 50 10
so 2 charts, each with 5 elements, and the following gnuplot instructions:
set terminal pngcairo truecolor size 800, 600
set output "data.png"
set style fill transparent solid 0.5
set style data boxes
set boxwidth 0.5
plot 'data.txt' using 1:2 title 'foo' linetype rgb 'red', \
'' using 1:3 title 'bar' linetype rgb 'web-blue'
you will get this:

How can I assign a color to a specific value in a column of a pandas dataframe?

I have a pandas dataframe with 3 columns: state, total, politics. I am trying to use sns.barplot to show a simple plot of each state with the total and color the state based on the value in the 'politics' column.
To illustrate, here's the bar chart I want done with Tableau:
Tableau bar chart - good!
However, when I plot in seaborn, I can't seem to figure out how to assign the states with "Red" as their value in the politics column to the actual color red on the graph!
The color palette seems to randomly assign colors to values, so "Red" states have blue bars, "Blue" states have green bars and "Swing" states have orange bars... it's confusing to the reader!!
You just need to assign the proper colors values using the palette argument of .barplot. But you also have to tell seaborn what color is each word in politics column assigned to, you can do this with one more column:
>>> data
total state politics
0 16.99 Maine Red
1 10.34 Oregon Blue
2 21.01 Colorado Swing
3 23.68 Utah Swing
4 24.59 Arkansas Red
5 25.29 Iowa Blue
Now we define a dictionary with the color mapping and use .apply with a lambda function to create a new column:
>>> colors = {'Red':'red','Blue':'blue','Swing':'yellow'}
>>> data['color'] = data['politics'].apply(lambda x: colors[x])
>>> data
total state politics color
0 16.99 Maine Red red
1 10.34 Oregon Blue blue
2 21.01 Colorado Swing yellow
3 23.68 Utah Swing yellow
4 24.59 Arkansas Red red
5 25.29 Iowa Blue blue
Notice it was also necessary to make "Red" and "Blue" lowercase, since matplotlib won't recognise those colors capitalised. Now we just need to use .barplot as usual, using the palette argument:
>>> sns.barplot(x='total',y='state',palette=data['color'], data=data)

Staggered bar chart in gnupplot

There is a great question about bar charts in gnuplot.
How do you plot bar charts in gnuplot?
What is missing (and what I'm asking about) is a staggered bar chart.
The example in the other question giving the bars side-by-side. The staggered bars there are additive. I want to have the bar in front of (or superimposed of) each other.
Let's say I have data:
10 20
30 50
60 80
10 50
0 20
I want 5 vertical bars.
The first one bottom 10 units are red, the next 10 units are blue. The next bar to The right has 30 units red on bottom and 20 units blue on top. Etc.
Thanks,
Gert
Does this do what you want (I wasn't sure I understood what you were aiming for)?:
set style data histogram
set style fill solid border -1
plot 'gert' u 1 lc 'red', '' u ($2 - $1) lc 'blue'

multiple legends in excel chart

Is there a way in Excel to have 2 legends for a single chart?
I have an excel chart with many series. Let's take the following structure.
X AY1 AY2 BY1 BY2 CY1 CY2
1 2 3 4 5 6 7
3 11 2 5 23 45 65
X column represents the horizontal scale the rest of the columns represent the vertical scales. A, B and C are something like a category, and Y1 and Y2 are series for each category. Now, Y1 and Y2 have the same line style, no matter what category, but the category gives the color.
So in this example Y1 is dashed and Y2 is dotted. A is blue, B is red and C is green. This leads to:
AY1 - blue dashed, AY2 - blue dotted,
BY1 - red dashed, BY2 - red dotted,
CY1 - green dashed,CY2 - green dotted.
Currently my legend is AY1, AY2 and so on, with the dash style and color.
Because I can have more than 10 categories with more than 2 series for each of them, I will end up with a legend of no. of categories * no. of series, which is not necessary.
Instead I would like a legend like: Y1 - dashed, Y2 - dotted(each series line type only once) and then a legend with the color for each category( A- red, B - blue, C - green).
Is this possible in Excel?
Thanks!
Excel only does one legend per chart. Each series will have an entry in the legend. You can manually select a legend entry and delete it.
You could manually construct a text box or similar, and place that on the chart to achieve the effect you describe.
So, if I understand correctly, I'd add two dummy series to the chart with 0 values and assign them dashed and dotted respectively, with a neutral gray color. Then delete every series but the gray ones from the legend.
Then create a drawing with the colors for the real data series and place it on top of the chart as a secondary legend.
Edit: thinking about this a bit more, here is another approach. Use dummy series purely for the purpose of showing in the legend. Consider this screenshot:
Your original data table has been charted and the series have been formatted as to your instructions above.
Then another set of data was added to the chart as new series.
Y1 and Y2 have been formatted with gray and dashed / dotted respectively
A, B and C have been added with their respective colors.
The next step is to click, select and delete the legend entries for AY1, AY2 etc., and keep only the legend entries for the helper series. Finally, edit the source data for the helper series and set all data to 0 or 1, so nothing gets plotted in the chart. The result looks like this:
You could even change the chart type for the colored helper series to a dot, so the legend will show a dot instead of a line:

gnuplot, drawing duplicated points and coloring

I have the below data in gnuplot:
2012-09-18 0 2 12
2012-03-15 1 4 5
2012-12-18 24 8 11
2012-09-18 2 8 11
2012-03-15 16 5 5
2011-12-06 5 2 3
2012-12-18 3 12 8
2012-09-18 4 4 8
2012-03-29 11 6 2
2011-12-06 9 7 3
2012-12-18 6 7 8
2012-09-18 4 3 8
2012-02-09 27 2 1
2012-12-18 2 1 8
2012-09-18 6 14 8
1st column; x (date)
2nd column; y
3rd column; the point color
4th column; number of occurrences(the point is duplicated)
I need to write a gnuplot program which:
Draws my (x,y) points.
Gives each point a different color depending on the 3rd column value (maybe over 50 different colors).
If the 4th column is greater than 0 then the point is duplicated and it must be drawn n times and give its x,y a random positing with a small margin. for example, (rand(x)-0.5,rand(y)-0.5).
Another question, what is the best and fastest way/tool to learn gnuplot?
This is supposed to be an extension to my answer for your other question drawing duplicated points in gnuplot with small margin:
You need to have the first column interpreted as time data. For this you need
set xdata time
set timefmt '%Y-%m-%d'
In order to set the point color, it is best to define a palette and then use linecolor palette, which sets the point color based on its value in the palette.
So, using the explanations from drawing duplicated points in gnuplot with small margin the final script is:
reset
filename = 'data.dat'
stats filename using 4 nooutput
set xdata time
set timefmt '%Y-%m-%d'
set format x '%Y-%m'
rand_x(x) = x + 60*60*24*7 * (rand(0) - 0.5)
rand_y(y) = y + (rand(0) - 0.5)
plot for [i=0:int(STATS_max)-1] filename \
using (rand_x(timecolumn(1))):(i < $4 ? rand_y($2) : 1/0):3 pointtype 7 linecolor palette notitle
Some other things you must have in mind are:
The stats call must come before set xdata time, because the statistics don't work with time data.
When calculating with time data in the using statement, one needs to use the timecolumn function (as opposed to column or $.. in generic cases). This gives the time as a timestamp (i.e. in seconds).
For that reason you need two different random functions for x and y, because of the very different scalings. Here, I used a 'jitter' of one week (60*60*24*7 seconds) on the time axis.
The result with 4.6.4 is:
Some remarks to your question about learning gnuplot: Try to solve your questions by yourself and then post more concrete questions! Browse through the gnuplot demos to see what is possible, look which feature or plotting style is used, look them up in the documentation, what options/settings are offered? Play around with those demos and try to apply that to your data sets etc. In the end its all about practice (I've been using gnuplot for 12 years...).

Resources