How to create a graph varying point size?
I have the following dataframe:
Madrugada Mañana Tarde Noche
Lunes 1 2 3 4
Martes 5 6 7 8
Miércoles 9 10 11 12
Jueves 13 14 15 16
Viernes 17 18 19 20
Sábado 21 22 23 24
Domingo 25 26 27 28
Created with:
import pandas as pd
index = ['Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo']
columns = ['Madrugada','Mañana', 'Tarde', 'Noche']
Cuadro = pd.DataFrame(index=index, columns=columns)
Cuadro.loc['Lunes'] = pd.Series({'Madrugada':1, 'Mañana':2, 'Tarde':3,
'Noche':4})
Cuadro.loc['Martes'] = pd.Series({'Madrugada':5, 'Mañana':6, 'Tarde':7,
'Noche':8})
Cuadro.loc['Miércoles'] = pd.Series({'Madrugada':9, 'Mañana':10, 'Tarde':11,
'Noche':12})
Cuadro.loc['Jueves'] = pd.Series({'Madrugada':13, 'Mañana':14, 'Tarde':15,
'Noche':16})
Cuadro.loc['Viernes'] = pd.Series({'Madrugada':17, 'Mañana':18, 'Tarde':19,
'Noche':20})
Cuadro.loc['Sábado'] = pd.Series({'Madrugada':21, 'Mañana':22, 'Tarde':23,
'Noche':24})
Cuadro.loc['Domingo'] = pd.Series({'Madrugada':25, 'Mañana':26, 'Tarde':27,
'Noche':28})
print(Cuadro)
How may I create a graph like:
Data Usage:
|Midnight o
|
|Night OOO
| OOO
|Afternoon
|
| o O O ( )
|Morning__________________________________________________________________
M T W Th F Sat Sun
Where the size of the points is dependant on the value of the cell?
Thanking you in advance for any help or recommendation...
Jose
python matplotlib
add a comment |
I have the following dataframe:
Madrugada Mañana Tarde Noche
Lunes 1 2 3 4
Martes 5 6 7 8
Miércoles 9 10 11 12
Jueves 13 14 15 16
Viernes 17 18 19 20
Sábado 21 22 23 24
Domingo 25 26 27 28
Created with:
import pandas as pd
index = ['Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo']
columns = ['Madrugada','Mañana', 'Tarde', 'Noche']
Cuadro = pd.DataFrame(index=index, columns=columns)
Cuadro.loc['Lunes'] = pd.Series({'Madrugada':1, 'Mañana':2, 'Tarde':3,
'Noche':4})
Cuadro.loc['Martes'] = pd.Series({'Madrugada':5, 'Mañana':6, 'Tarde':7,
'Noche':8})
Cuadro.loc['Miércoles'] = pd.Series({'Madrugada':9, 'Mañana':10, 'Tarde':11,
'Noche':12})
Cuadro.loc['Jueves'] = pd.Series({'Madrugada':13, 'Mañana':14, 'Tarde':15,
'Noche':16})
Cuadro.loc['Viernes'] = pd.Series({'Madrugada':17, 'Mañana':18, 'Tarde':19,
'Noche':20})
Cuadro.loc['Sábado'] = pd.Series({'Madrugada':21, 'Mañana':22, 'Tarde':23,
'Noche':24})
Cuadro.loc['Domingo'] = pd.Series({'Madrugada':25, 'Mañana':26, 'Tarde':27,
'Noche':28})
print(Cuadro)
How may I create a graph like:
Data Usage:
|Midnight o
|
|Night OOO
| OOO
|Afternoon
|
| o O O ( )
|Morning__________________________________________________________________
M T W Th F Sat Sun
Where the size of the points is dependant on the value of the cell?
Thanking you in advance for any help or recommendation...
Jose
python matplotlib
You can add a list of sizes to matplotlib'sscatter
: stackoverflow.com/questions/14827650/…
– user8408080
Nov 21 '18 at 2:12
Thank you for the suggestion, How that could be implemented to create a graph with varying point size (dependant on the value of the cell) as described above?
– José Luis Martínez
Nov 21 '18 at 2:32
add a comment |
I have the following dataframe:
Madrugada Mañana Tarde Noche
Lunes 1 2 3 4
Martes 5 6 7 8
Miércoles 9 10 11 12
Jueves 13 14 15 16
Viernes 17 18 19 20
Sábado 21 22 23 24
Domingo 25 26 27 28
Created with:
import pandas as pd
index = ['Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo']
columns = ['Madrugada','Mañana', 'Tarde', 'Noche']
Cuadro = pd.DataFrame(index=index, columns=columns)
Cuadro.loc['Lunes'] = pd.Series({'Madrugada':1, 'Mañana':2, 'Tarde':3,
'Noche':4})
Cuadro.loc['Martes'] = pd.Series({'Madrugada':5, 'Mañana':6, 'Tarde':7,
'Noche':8})
Cuadro.loc['Miércoles'] = pd.Series({'Madrugada':9, 'Mañana':10, 'Tarde':11,
'Noche':12})
Cuadro.loc['Jueves'] = pd.Series({'Madrugada':13, 'Mañana':14, 'Tarde':15,
'Noche':16})
Cuadro.loc['Viernes'] = pd.Series({'Madrugada':17, 'Mañana':18, 'Tarde':19,
'Noche':20})
Cuadro.loc['Sábado'] = pd.Series({'Madrugada':21, 'Mañana':22, 'Tarde':23,
'Noche':24})
Cuadro.loc['Domingo'] = pd.Series({'Madrugada':25, 'Mañana':26, 'Tarde':27,
'Noche':28})
print(Cuadro)
How may I create a graph like:
Data Usage:
|Midnight o
|
|Night OOO
| OOO
|Afternoon
|
| o O O ( )
|Morning__________________________________________________________________
M T W Th F Sat Sun
Where the size of the points is dependant on the value of the cell?
Thanking you in advance for any help or recommendation...
Jose
python matplotlib
I have the following dataframe:
Madrugada Mañana Tarde Noche
Lunes 1 2 3 4
Martes 5 6 7 8
Miércoles 9 10 11 12
Jueves 13 14 15 16
Viernes 17 18 19 20
Sábado 21 22 23 24
Domingo 25 26 27 28
Created with:
import pandas as pd
index = ['Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo']
columns = ['Madrugada','Mañana', 'Tarde', 'Noche']
Cuadro = pd.DataFrame(index=index, columns=columns)
Cuadro.loc['Lunes'] = pd.Series({'Madrugada':1, 'Mañana':2, 'Tarde':3,
'Noche':4})
Cuadro.loc['Martes'] = pd.Series({'Madrugada':5, 'Mañana':6, 'Tarde':7,
'Noche':8})
Cuadro.loc['Miércoles'] = pd.Series({'Madrugada':9, 'Mañana':10, 'Tarde':11,
'Noche':12})
Cuadro.loc['Jueves'] = pd.Series({'Madrugada':13, 'Mañana':14, 'Tarde':15,
'Noche':16})
Cuadro.loc['Viernes'] = pd.Series({'Madrugada':17, 'Mañana':18, 'Tarde':19,
'Noche':20})
Cuadro.loc['Sábado'] = pd.Series({'Madrugada':21, 'Mañana':22, 'Tarde':23,
'Noche':24})
Cuadro.loc['Domingo'] = pd.Series({'Madrugada':25, 'Mañana':26, 'Tarde':27,
'Noche':28})
print(Cuadro)
How may I create a graph like:
Data Usage:
|Midnight o
|
|Night OOO
| OOO
|Afternoon
|
| o O O ( )
|Morning__________________________________________________________________
M T W Th F Sat Sun
Where the size of the points is dependant on the value of the cell?
Thanking you in advance for any help or recommendation...
Jose
python matplotlib
python matplotlib
edited Nov 21 '18 at 3:32
José Luis Martínez
asked Nov 21 '18 at 0:35
José Luis MartínezJosé Luis Martínez
308
308
You can add a list of sizes to matplotlib'sscatter
: stackoverflow.com/questions/14827650/…
– user8408080
Nov 21 '18 at 2:12
Thank you for the suggestion, How that could be implemented to create a graph with varying point size (dependant on the value of the cell) as described above?
– José Luis Martínez
Nov 21 '18 at 2:32
add a comment |
You can add a list of sizes to matplotlib'sscatter
: stackoverflow.com/questions/14827650/…
– user8408080
Nov 21 '18 at 2:12
Thank you for the suggestion, How that could be implemented to create a graph with varying point size (dependant on the value of the cell) as described above?
– José Luis Martínez
Nov 21 '18 at 2:32
You can add a list of sizes to matplotlib's
scatter
: stackoverflow.com/questions/14827650/…– user8408080
Nov 21 '18 at 2:12
You can add a list of sizes to matplotlib's
scatter
: stackoverflow.com/questions/14827650/…– user8408080
Nov 21 '18 at 2:12
Thank you for the suggestion, How that could be implemented to create a graph with varying point size (dependant on the value of the cell) as described above?
– José Luis Martínez
Nov 21 '18 at 2:32
Thank you for the suggestion, How that could be implemented to create a graph with varying point size (dependant on the value of the cell) as described above?
– José Luis Martínez
Nov 21 '18 at 2:32
add a comment |
1 Answer
1
active
oldest
votes
data.csv
Day,Midnight,Morning,Afternoon,Night
Monday,4.002900,30.905096,25.193066,23.704473
Tuesday,22.074967,16.407200,50.409445,27.396373
Wednesday,18.875000,28.415111,22.205521,25.744592
Thursday,12.470333,16.265086,15.390797,81.988800
Friday,NaN,33.658050,23.814764,20.096790
Saturday,12.647037,16.545295,25.620673,14.903473
Sunday,4.975500,19.023320,21.215298,45.440120
code.py
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("data.csv")
fig, ax = plt.subplots()
ax.scatter(df['Day'], ['Midnight']*7, s=20*df['Midnight'])
ax.scatter(df['Day'], ['Morning']*7, s=20*df['Morning'])
ax.scatter(df['Day'], ['Afternoon']*7, s=20*df['Afternoon'])
ax.scatter(df['Day'], ['Night']*7, s=20*df['Night'])
plt.ylabel('Time of Day')
plt.xlabel('Day of the Week')
plt.show()
Resulting Plot
Fantastic answer Conner!!!!
– José Luis Martínez
Nov 21 '18 at 12:57
Thank you so much...
– José Luis Martínez
Nov 21 '18 at 12:57
It was exactly what I was needing to finish my project 😃
– José Luis Martínez
Nov 21 '18 at 12:58
Really......Thanks again!
– José Luis Martínez
Nov 21 '18 at 13:07
If it helped you can designate an accepted answer with the check mark to the left of my answer. Cheers :)
– Conner
Nov 21 '18 at 13:45
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403689%2fhow-to-create-a-graph-varying-point-size%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
data.csv
Day,Midnight,Morning,Afternoon,Night
Monday,4.002900,30.905096,25.193066,23.704473
Tuesday,22.074967,16.407200,50.409445,27.396373
Wednesday,18.875000,28.415111,22.205521,25.744592
Thursday,12.470333,16.265086,15.390797,81.988800
Friday,NaN,33.658050,23.814764,20.096790
Saturday,12.647037,16.545295,25.620673,14.903473
Sunday,4.975500,19.023320,21.215298,45.440120
code.py
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("data.csv")
fig, ax = plt.subplots()
ax.scatter(df['Day'], ['Midnight']*7, s=20*df['Midnight'])
ax.scatter(df['Day'], ['Morning']*7, s=20*df['Morning'])
ax.scatter(df['Day'], ['Afternoon']*7, s=20*df['Afternoon'])
ax.scatter(df['Day'], ['Night']*7, s=20*df['Night'])
plt.ylabel('Time of Day')
plt.xlabel('Day of the Week')
plt.show()
Resulting Plot
Fantastic answer Conner!!!!
– José Luis Martínez
Nov 21 '18 at 12:57
Thank you so much...
– José Luis Martínez
Nov 21 '18 at 12:57
It was exactly what I was needing to finish my project 😃
– José Luis Martínez
Nov 21 '18 at 12:58
Really......Thanks again!
– José Luis Martínez
Nov 21 '18 at 13:07
If it helped you can designate an accepted answer with the check mark to the left of my answer. Cheers :)
– Conner
Nov 21 '18 at 13:45
|
show 4 more comments
data.csv
Day,Midnight,Morning,Afternoon,Night
Monday,4.002900,30.905096,25.193066,23.704473
Tuesday,22.074967,16.407200,50.409445,27.396373
Wednesday,18.875000,28.415111,22.205521,25.744592
Thursday,12.470333,16.265086,15.390797,81.988800
Friday,NaN,33.658050,23.814764,20.096790
Saturday,12.647037,16.545295,25.620673,14.903473
Sunday,4.975500,19.023320,21.215298,45.440120
code.py
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("data.csv")
fig, ax = plt.subplots()
ax.scatter(df['Day'], ['Midnight']*7, s=20*df['Midnight'])
ax.scatter(df['Day'], ['Morning']*7, s=20*df['Morning'])
ax.scatter(df['Day'], ['Afternoon']*7, s=20*df['Afternoon'])
ax.scatter(df['Day'], ['Night']*7, s=20*df['Night'])
plt.ylabel('Time of Day')
plt.xlabel('Day of the Week')
plt.show()
Resulting Plot
Fantastic answer Conner!!!!
– José Luis Martínez
Nov 21 '18 at 12:57
Thank you so much...
– José Luis Martínez
Nov 21 '18 at 12:57
It was exactly what I was needing to finish my project 😃
– José Luis Martínez
Nov 21 '18 at 12:58
Really......Thanks again!
– José Luis Martínez
Nov 21 '18 at 13:07
If it helped you can designate an accepted answer with the check mark to the left of my answer. Cheers :)
– Conner
Nov 21 '18 at 13:45
|
show 4 more comments
data.csv
Day,Midnight,Morning,Afternoon,Night
Monday,4.002900,30.905096,25.193066,23.704473
Tuesday,22.074967,16.407200,50.409445,27.396373
Wednesday,18.875000,28.415111,22.205521,25.744592
Thursday,12.470333,16.265086,15.390797,81.988800
Friday,NaN,33.658050,23.814764,20.096790
Saturday,12.647037,16.545295,25.620673,14.903473
Sunday,4.975500,19.023320,21.215298,45.440120
code.py
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("data.csv")
fig, ax = plt.subplots()
ax.scatter(df['Day'], ['Midnight']*7, s=20*df['Midnight'])
ax.scatter(df['Day'], ['Morning']*7, s=20*df['Morning'])
ax.scatter(df['Day'], ['Afternoon']*7, s=20*df['Afternoon'])
ax.scatter(df['Day'], ['Night']*7, s=20*df['Night'])
plt.ylabel('Time of Day')
plt.xlabel('Day of the Week')
plt.show()
Resulting Plot
data.csv
Day,Midnight,Morning,Afternoon,Night
Monday,4.002900,30.905096,25.193066,23.704473
Tuesday,22.074967,16.407200,50.409445,27.396373
Wednesday,18.875000,28.415111,22.205521,25.744592
Thursday,12.470333,16.265086,15.390797,81.988800
Friday,NaN,33.658050,23.814764,20.096790
Saturday,12.647037,16.545295,25.620673,14.903473
Sunday,4.975500,19.023320,21.215298,45.440120
code.py
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("data.csv")
fig, ax = plt.subplots()
ax.scatter(df['Day'], ['Midnight']*7, s=20*df['Midnight'])
ax.scatter(df['Day'], ['Morning']*7, s=20*df['Morning'])
ax.scatter(df['Day'], ['Afternoon']*7, s=20*df['Afternoon'])
ax.scatter(df['Day'], ['Night']*7, s=20*df['Night'])
plt.ylabel('Time of Day')
plt.xlabel('Day of the Week')
plt.show()
Resulting Plot
answered Nov 21 '18 at 4:28
ConnerConner
23.5k84568
23.5k84568
Fantastic answer Conner!!!!
– José Luis Martínez
Nov 21 '18 at 12:57
Thank you so much...
– José Luis Martínez
Nov 21 '18 at 12:57
It was exactly what I was needing to finish my project 😃
– José Luis Martínez
Nov 21 '18 at 12:58
Really......Thanks again!
– José Luis Martínez
Nov 21 '18 at 13:07
If it helped you can designate an accepted answer with the check mark to the left of my answer. Cheers :)
– Conner
Nov 21 '18 at 13:45
|
show 4 more comments
Fantastic answer Conner!!!!
– José Luis Martínez
Nov 21 '18 at 12:57
Thank you so much...
– José Luis Martínez
Nov 21 '18 at 12:57
It was exactly what I was needing to finish my project 😃
– José Luis Martínez
Nov 21 '18 at 12:58
Really......Thanks again!
– José Luis Martínez
Nov 21 '18 at 13:07
If it helped you can designate an accepted answer with the check mark to the left of my answer. Cheers :)
– Conner
Nov 21 '18 at 13:45
Fantastic answer Conner!!!!
– José Luis Martínez
Nov 21 '18 at 12:57
Fantastic answer Conner!!!!
– José Luis Martínez
Nov 21 '18 at 12:57
Thank you so much...
– José Luis Martínez
Nov 21 '18 at 12:57
Thank you so much...
– José Luis Martínez
Nov 21 '18 at 12:57
It was exactly what I was needing to finish my project 😃
– José Luis Martínez
Nov 21 '18 at 12:58
It was exactly what I was needing to finish my project 😃
– José Luis Martínez
Nov 21 '18 at 12:58
Really......Thanks again!
– José Luis Martínez
Nov 21 '18 at 13:07
Really......Thanks again!
– José Luis Martínez
Nov 21 '18 at 13:07
If it helped you can designate an accepted answer with the check mark to the left of my answer. Cheers :)
– Conner
Nov 21 '18 at 13:45
If it helped you can designate an accepted answer with the check mark to the left of my answer. Cheers :)
– Conner
Nov 21 '18 at 13:45
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403689%2fhow-to-create-a-graph-varying-point-size%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can add a list of sizes to matplotlib's
scatter
: stackoverflow.com/questions/14827650/…– user8408080
Nov 21 '18 at 2:12
Thank you for the suggestion, How that could be implemented to create a graph with varying point size (dependant on the value of the cell) as described above?
– José Luis Martínez
Nov 21 '18 at 2:32