Improve Plotly line when there is too much line making it hard to read the graph - plotly-dash

I have this down and wanted to know if I can have the graph show one line first and then add the other lines because it's messy and you can't really see any of the lines when they first appear.
This is what I have now:
I want it to look sth like this at the very start:
This is my code:
# Line plot for Hour VS Bicycle Rented
hour_line_plot1 = px.line(
data_frame=df_bike.groupby(['DayofWeek','Hour']).mean('Count').reset_index(),
x='Hour', y='Count', color='DayofWeek', markers=True,
labels={'Hour': 'Time', 'Count': 'Average Bike Used'},
template="simple_white"
)

Related

How to add mass item to the Mysql in Django

I made a django website and i must add thousands of item to mysql but my mind is now stopped.
When you see the picture, rubik, remedi and point fields available.
I have a sentence forexamle: Headache : Pulsatilla(3)
I click the rubik field choose headache, and then click remedi field choose pulsatilla, and then lastly click point field and choose 3 point.
Everything is good.
But, when i have sentence like this;
ABSORBED, buried in thought : Acon., aloe., am-m., ant-c., arn., bell., bov., calc., cann-i., canth., caps., carl., caust., cham., chin., cic., clem., cocc., con., cupr., cycl., elaps., grat., ham., Hell., ign., ip., lil-t., mang., merc., Mez., mosch., mur-ac., nat-c., nat-m., nat-p., nit-ac., Nux-m., ol-an., onos., op., phel., phos., puls., rheum., sabad., sars., spig., stann., stram., Sulph.
I don't know how to add this easily.
I wanna explain this sentence.
ABSORBED, buried in thought = This is rubik
Acon., aloe., am-m., ant-c., arn., bell., = These are remedi (each one). Bold remedi (for. Acon) = 3 point, italic remedi (for. caps) = 2 point and other remedies = 1 point.
When i use django admin panel it will took too many times because one by one add. And how can i add this rubik and remedies and points easily. I need vision.
Thanks for your supports.

SSRS chart lines not connecting

I have an SSRS Line chart which plots supply points with square feet on the X axis and Price on the Y axis. Right now I don't really care about making it pretty just getting the lines to show up correctly. I am plotting the points and grouping by Subdivision/Builder.
So for example Subdivision A has builders Y and Z. I want to show different colors and lines for Subdivision A builder Y verses Subdivision A Builder Z.
The problem is that the lines are not connecting when a point for another subdivision builder combination breaks up that line.
The grey line and points below are not all connected as the yellow point is between the grey points so the grey line is not connected to all grey points.
How can I make the points of the same color (same Subdivision/Builder) connected via a line?
As I found out the hard way recently, this problem is often caused by null values in the data not being properly handled by SSRS. Without seeing your data, I can't be certain that's the cause, but nulls were the culprit I encountered the same behavior.
The solutions usually involve assigning values to the color of the EmptyPoint property on the Series, sometimes in conjunction with setting the EmptyPointValue to specify null handling. I've found many references to this problem on the web, but I'll only post links to the best two, both of which are on StackExchange:
The thread SSRS Line Chart NULL VALUE - Horizontal Line contains a thorough discussion of this issue. The usual workaround given is to hard-code a color expression for each line using an IIf, but sometimes this isn't an option, especially if the field you're grouping on has dynamic, unpredictable values, as my dataset did.
The picture posted there depicts clear examples of the same type of line breaks. The user named trubs posted a code sample which illustrates how to set the EmptyPoint, in case where an Iif will work:
=iif(isNothing(Fields!SelectedValue.Value),'No Color',"LightBlue")
The first reply in SSRS Line Chart Not Connecting Data Points details a workaround for cases when the EmptyPoint value & nulls are the root cause and simple hard-coded IIfs won't do the trick. Although I have yet to get my line colors to match the point markers the way I'd like, I can verify that this solution at least gives you your lines back and allows you to assign a variety of colors to them. It's fairly simple and involves merely pasting in some VB code for a couple color properties.
I was asked in the comments section to provide the details of the solutions, but don't want to plagiarize, so I'll simply do a long direct quote of JohnBob's answer:
Firstly, in order to get the lines to join up, you need to set the
EmptyPoint colour for the series.
Select your series in your chart In the properties tab (not the
dialog) drill down into the EmptyPoint property and set the colour to
be Black
This will get them joining up - yay! But part of the line is colour
and the other part is black, right? That's a bit silly, especially
considering if you leave the colour to Automatic on the EmptyPoint
that it will be transparent.
So, then we need to get the series and the EmptyPoint's colours in
sync. Using code from here. I added some code to the code of the
report.
1). Right click on an empty space on the report and select "Report
Properties" 2). In the code tab, paste the following:
Private colorPalette As String() = {"#418CF0", "#FCB441", "#E0400A", "#05642E", "#1A3B69", "#BFBFBF", "#E0400A", "#FCB441", "DarkBlue", "Tomato", "Orange", "CornflowerBlue", "Gold", "Red", "Green", "LightBlue", "Lime", "Maroon", "LightSteelBlue", "Tan", "Silver"}
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
Then we need to call this code when setting the colour of the series
and of the EmptyPoint.
Select your series
In the properties tab paste something the following (replace WhateverTheGroupIsForYourSeries with your series group name):
=Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)
Drill down to the color element of the EmptyPoint Series property
Paste the same text as from point two [e.g. =Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)]
And voila! You're done! I can't believe how unnecessarily difficult
this is :D
I hope this helps.
Just put your Fields!(YourSeriesGroup).Value in Series Groups to above of
Fields!(YourCategoryGroup).Value in Category Groups, your series group should be in both Series Groups and Category Groups (should be above of your initial category group).
And after that right click horizontal axis and select Horizontal Axis Properties. Set Axis Type to Scalar and click OK.

Plotting a histogram using a csv file

I have a csv file with the following format.
Label 1, 20
Label 2, 10
Label 3, 30
.
.
.
LabelN, 5
How do I plot the second column using the labels given in the csv file as labels on the x-axis?
(Something like this, where 1891-1900 is a label)
EDIT:
Found these questions which are quite similar to mine,
Plotting word frequency histogram using gnuplot
Gnuplot xticlabels with several lines
After trying the commands given in answer 1.
set xtics border in scale 1,0.5 nomirror rotate by -90 offset character 0, 0, 0
plot "data.txt" using 2:xticlabels(1) with histogram
I'm getting a not so clean histogram because the number of labels is quite large. I've tried the formatting given in answer 2. Can anyone suggest a way to get a cleaner histogram?
You have several options:
Plot only the important labels (extremes, mean etc. for example)
Skip every 5th label or so if labels form a series
Split your graph if you must plot every single label.
Seems like case 2) applies here, and thus skipping some of the labels before plotting will make the plot look better.
You can pre-process the file to skip every 5th label (say) using something like the following script:
line_number = 0
for line in open("d1.txt", "r"):
line_split = line.split(",")
if(line_number % 5 == 0):
print line,
else:
print ",",line_split[1],
line_number += 1
You can now plot with appropriate font size
set xtics border in scale 1,0.5 nomirror rotate by -90 offset character 0, 0, 0
set xtics font ",9"
plot "d2.txt" using 2:xticlabels(1) with histogram title "legend_here"

How can I show the output of two print statements from two different functions on the same line?

The code for my question is as follows:
def score_Calc(par, strokes, hole_number):
if strokes == par - 1:
print ('On hole #',hole_number, 'a par',par,'you shot a birdie.')
def score_Calcs (par, strokes, hole_number):
if strokes == 1:
print('with a Hole in One!')
My question is this: How can I get the printed results on one line? Right now, I've got it printing out as:
On hole # 5 a par 5 you shot 5 over par.
with a Bo Derek. Bummer.
How can I get it to print out as this?
On hole # 5 a par 5 you shot 5 over par. with a Bo Derek. Bummer.
I realize the code doesn't make much sense, as it is not my full program. My problem is when I execute the main function, it prints out as two seperate lines. How can I make it just one line with the input from the two different functions?
By default, print ends with a newline character. This call
print("Hello World")
is in reality used like that by Python :
print("Hello World", end='\n')
Basically you just need to change the ending :
print ('On hole #',hole_number, 'a par',par,'you shot a birdie.', end=' ')

is line folded? - How to check for folds in VIM

I'm writing some folding functions and I am at a point where I need to check if the current line is actually a fold.
The reason for this is because it is a custom fold method that depends on searching/matching certain lines.
For example, if the current line is folded and looks like:
-FOO------------------------
If you do something like:
getline('.')
You would basically get FOO so there is no way (that I know of) to know if I am at a fold or not.
Is there a helper function for this?
I would think it would have to be something like:
is_folded('.')
I could probably mess with the foldtext to assign a special title for the fold but I want to avoid this.
From :help eval.txt
foldclosed({lnum})
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the first line in that fold.
If the line {lnum} is not in a closed fold, -1 is returned.
You can check for a given line if it returns -1 or a line number, you can probably implement your isfolded() function this way.
If you are looking for Vim script function or feature , it is a good idea to start by searching in eval.txt which contains lots of relevant information.