How to create a graph varying point size?












3















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










share|improve this question

























  • 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
















3















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










share|improve this question

























  • 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














3












3








3








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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'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



















  • 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

















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












1 Answer
1






active

oldest

votes


















3















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




enter image description here






share|improve this answer
























  • 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











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
});


}
});














draft saved

draft discarded


















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









3















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




enter image description here






share|improve this answer
























  • 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
















3















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




enter image description here






share|improve this answer
























  • 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














3












3








3








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




enter image description here






share|improve this answer














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




enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










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



















  • 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




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()