How to keep the same scale/levels across different kdeplot (seaborn 2D plot)?
I plot seaborn's kdeplot
using subsets of a dataset. the main dataset contains people detections and are the coordinates on a map.There can be many detections in a single frame. the data contains detections of 24 hours
Data format :
[time/frame_number, x_cordinate, y_cordinate]
Problem
When i draw two different kdeplot
using two subsets data (say 1-2pm and 10-11pm), Both plots are drawn fine.
By exploring the the data i found out that 1-2pm is rush hour, where there are many detections and 10-11pm is closing time where detections are way less. but kdeplot
represents the data in same scale (red density areas). This behavior is understandable, Since kde defines the scale based on local max and min values.
Requirement
I want to plot hour-wise kde plots, but i want the scale to be constant over the whole day. Meaning, if 1-2pm is rush-hour, the red density areas are shown there. but at 10-11pm when there mild traffic, the color should not be red, rather lower density colors (green, blue), Since as compared to rush-hour the detections would be very less.
Inshort making scale/levels based on 24 hour min, max values and using consistently in hour-wise plots
python matplotlib seaborn heatmap
add a comment |
I plot seaborn's kdeplot
using subsets of a dataset. the main dataset contains people detections and are the coordinates on a map.There can be many detections in a single frame. the data contains detections of 24 hours
Data format :
[time/frame_number, x_cordinate, y_cordinate]
Problem
When i draw two different kdeplot
using two subsets data (say 1-2pm and 10-11pm), Both plots are drawn fine.
By exploring the the data i found out that 1-2pm is rush hour, where there are many detections and 10-11pm is closing time where detections are way less. but kdeplot
represents the data in same scale (red density areas). This behavior is understandable, Since kde defines the scale based on local max and min values.
Requirement
I want to plot hour-wise kde plots, but i want the scale to be constant over the whole day. Meaning, if 1-2pm is rush-hour, the red density areas are shown there. but at 10-11pm when there mild traffic, the color should not be red, rather lower density colors (green, blue), Since as compared to rush-hour the detections would be very less.
Inshort making scale/levels based on 24 hour min, max values and using consistently in hour-wise plots
python matplotlib seaborn heatmap
A kernel density estimate is always normalized, such that the integral is 1. A different scaling is hence rather related to a different spread of the data, not the number of occurences. Therefore I'm not sure what you really want to show? Maybe a KDE is not at all suited to what you're after?
– ImportanceOfBeingErnest
Nov 26 '18 at 16:58
Hmm. the idea is to show a heatmap on the floor map (image) rather than simple dots (detection points), where heatmap gradient (red-to-blue shade) represents density of detections. Now lets say at 1-2pm, there were 200 people in a certain location, and from 10-11pm there were 40 people in that same location. When i plot two kdeplots on hour-wise data, 40 in 10-11pm is given the same gradient (red) as the 200 in 1-2pm. I may be using kde where i am not supposed to. can you suggest some other plot?. Thanks
– Qaisar Rajput
Nov 26 '18 at 17:15
I might be wrong, but I think what you want is to plot the kde times the total number of occurences. Or maybe just the 2d histogram?
– ImportanceOfBeingErnest
Nov 26 '18 at 18:39
add a comment |
I plot seaborn's kdeplot
using subsets of a dataset. the main dataset contains people detections and are the coordinates on a map.There can be many detections in a single frame. the data contains detections of 24 hours
Data format :
[time/frame_number, x_cordinate, y_cordinate]
Problem
When i draw two different kdeplot
using two subsets data (say 1-2pm and 10-11pm), Both plots are drawn fine.
By exploring the the data i found out that 1-2pm is rush hour, where there are many detections and 10-11pm is closing time where detections are way less. but kdeplot
represents the data in same scale (red density areas). This behavior is understandable, Since kde defines the scale based on local max and min values.
Requirement
I want to plot hour-wise kde plots, but i want the scale to be constant over the whole day. Meaning, if 1-2pm is rush-hour, the red density areas are shown there. but at 10-11pm when there mild traffic, the color should not be red, rather lower density colors (green, blue), Since as compared to rush-hour the detections would be very less.
Inshort making scale/levels based on 24 hour min, max values and using consistently in hour-wise plots
python matplotlib seaborn heatmap
I plot seaborn's kdeplot
using subsets of a dataset. the main dataset contains people detections and are the coordinates on a map.There can be many detections in a single frame. the data contains detections of 24 hours
Data format :
[time/frame_number, x_cordinate, y_cordinate]
Problem
When i draw two different kdeplot
using two subsets data (say 1-2pm and 10-11pm), Both plots are drawn fine.
By exploring the the data i found out that 1-2pm is rush hour, where there are many detections and 10-11pm is closing time where detections are way less. but kdeplot
represents the data in same scale (red density areas). This behavior is understandable, Since kde defines the scale based on local max and min values.
Requirement
I want to plot hour-wise kde plots, but i want the scale to be constant over the whole day. Meaning, if 1-2pm is rush-hour, the red density areas are shown there. but at 10-11pm when there mild traffic, the color should not be red, rather lower density colors (green, blue), Since as compared to rush-hour the detections would be very less.
Inshort making scale/levels based on 24 hour min, max values and using consistently in hour-wise plots
python matplotlib seaborn heatmap
python matplotlib seaborn heatmap
asked Nov 26 '18 at 12:17
Qaisar RajputQaisar Rajput
350316
350316
A kernel density estimate is always normalized, such that the integral is 1. A different scaling is hence rather related to a different spread of the data, not the number of occurences. Therefore I'm not sure what you really want to show? Maybe a KDE is not at all suited to what you're after?
– ImportanceOfBeingErnest
Nov 26 '18 at 16:58
Hmm. the idea is to show a heatmap on the floor map (image) rather than simple dots (detection points), where heatmap gradient (red-to-blue shade) represents density of detections. Now lets say at 1-2pm, there were 200 people in a certain location, and from 10-11pm there were 40 people in that same location. When i plot two kdeplots on hour-wise data, 40 in 10-11pm is given the same gradient (red) as the 200 in 1-2pm. I may be using kde where i am not supposed to. can you suggest some other plot?. Thanks
– Qaisar Rajput
Nov 26 '18 at 17:15
I might be wrong, but I think what you want is to plot the kde times the total number of occurences. Or maybe just the 2d histogram?
– ImportanceOfBeingErnest
Nov 26 '18 at 18:39
add a comment |
A kernel density estimate is always normalized, such that the integral is 1. A different scaling is hence rather related to a different spread of the data, not the number of occurences. Therefore I'm not sure what you really want to show? Maybe a KDE is not at all suited to what you're after?
– ImportanceOfBeingErnest
Nov 26 '18 at 16:58
Hmm. the idea is to show a heatmap on the floor map (image) rather than simple dots (detection points), where heatmap gradient (red-to-blue shade) represents density of detections. Now lets say at 1-2pm, there were 200 people in a certain location, and from 10-11pm there were 40 people in that same location. When i plot two kdeplots on hour-wise data, 40 in 10-11pm is given the same gradient (red) as the 200 in 1-2pm. I may be using kde where i am not supposed to. can you suggest some other plot?. Thanks
– Qaisar Rajput
Nov 26 '18 at 17:15
I might be wrong, but I think what you want is to plot the kde times the total number of occurences. Or maybe just the 2d histogram?
– ImportanceOfBeingErnest
Nov 26 '18 at 18:39
A kernel density estimate is always normalized, such that the integral is 1. A different scaling is hence rather related to a different spread of the data, not the number of occurences. Therefore I'm not sure what you really want to show? Maybe a KDE is not at all suited to what you're after?
– ImportanceOfBeingErnest
Nov 26 '18 at 16:58
A kernel density estimate is always normalized, such that the integral is 1. A different scaling is hence rather related to a different spread of the data, not the number of occurences. Therefore I'm not sure what you really want to show? Maybe a KDE is not at all suited to what you're after?
– ImportanceOfBeingErnest
Nov 26 '18 at 16:58
Hmm. the idea is to show a heatmap on the floor map (image) rather than simple dots (detection points), where heatmap gradient (red-to-blue shade) represents density of detections. Now lets say at 1-2pm, there were 200 people in a certain location, and from 10-11pm there were 40 people in that same location. When i plot two kdeplots on hour-wise data, 40 in 10-11pm is given the same gradient (red) as the 200 in 1-2pm. I may be using kde where i am not supposed to. can you suggest some other plot?. Thanks
– Qaisar Rajput
Nov 26 '18 at 17:15
Hmm. the idea is to show a heatmap on the floor map (image) rather than simple dots (detection points), where heatmap gradient (red-to-blue shade) represents density of detections. Now lets say at 1-2pm, there were 200 people in a certain location, and from 10-11pm there were 40 people in that same location. When i plot two kdeplots on hour-wise data, 40 in 10-11pm is given the same gradient (red) as the 200 in 1-2pm. I may be using kde where i am not supposed to. can you suggest some other plot?. Thanks
– Qaisar Rajput
Nov 26 '18 at 17:15
I might be wrong, but I think what you want is to plot the kde times the total number of occurences. Or maybe just the 2d histogram?
– ImportanceOfBeingErnest
Nov 26 '18 at 18:39
I might be wrong, but I think what you want is to plot the kde times the total number of occurences. Or maybe just the 2d histogram?
– ImportanceOfBeingErnest
Nov 26 '18 at 18:39
add a comment |
0
active
oldest
votes
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%2f53480969%2fhow-to-keep-the-same-scale-levels-across-different-kdeplot-seaborn-2d-plot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f53480969%2fhow-to-keep-the-same-scale-levels-across-different-kdeplot-seaborn-2d-plot%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
A kernel density estimate is always normalized, such that the integral is 1. A different scaling is hence rather related to a different spread of the data, not the number of occurences. Therefore I'm not sure what you really want to show? Maybe a KDE is not at all suited to what you're after?
– ImportanceOfBeingErnest
Nov 26 '18 at 16:58
Hmm. the idea is to show a heatmap on the floor map (image) rather than simple dots (detection points), where heatmap gradient (red-to-blue shade) represents density of detections. Now lets say at 1-2pm, there were 200 people in a certain location, and from 10-11pm there were 40 people in that same location. When i plot two kdeplots on hour-wise data, 40 in 10-11pm is given the same gradient (red) as the 200 in 1-2pm. I may be using kde where i am not supposed to. can you suggest some other plot?. Thanks
– Qaisar Rajput
Nov 26 '18 at 17:15
I might be wrong, but I think what you want is to plot the kde times the total number of occurences. Or maybe just the 2d histogram?
– ImportanceOfBeingErnest
Nov 26 '18 at 18:39