Recursively adding joypy.joyplot as subplot to one matplotlib plot
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have been using joypy for plotting what is called ridgeline/joy plots. I want to divide my dataframe equally into several parts, and recursively making each one of them as joy plot and adding them altogether for the ease of visualisation. Without doing so I just get one very long plot which is difficult to view. I have tried using subplots
and making a new joypy.joyplot
within a for-loop, but no success :(
import joypy
import mplcursors
from matplotlib import cm
import matplotlib.pyplot as plt
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
x_range = list(range(len(data)))
fig, axes = joypy.joyplot(data, kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10))
axes[-1].set_xticks(x_range);
mplcursors.cursor(hover=True)
fig.savefig('joyplot.png', bbox_inches='tight')
What I have tried:
import joypy
from matplotlib import cm
import matplotlib.pyplot as plt
f, a = plt.subplots(2, 1)
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
for c, i in enumerate(range(0, len(data), 50)):
x_range = list(range(i, i+50, 1))
fig, axes = joypy.joyplot(data[i:i+50], kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10),
title="Emotion evolution over an interview")
# I don't know what to do here so the current fig can be added as subplot..
a[c].set_xticks(x_range);
fig.show()
Also, does anyone know how to make the plot interactive, as when my mouse hover over the plot then the its value of the y-axis appears. mplcursors
doesn't seem to work. Any help is appreciated! Thanks.
python matplotlib plot data-visualization
|
show 4 more comments
I have been using joypy for plotting what is called ridgeline/joy plots. I want to divide my dataframe equally into several parts, and recursively making each one of them as joy plot and adding them altogether for the ease of visualisation. Without doing so I just get one very long plot which is difficult to view. I have tried using subplots
and making a new joypy.joyplot
within a for-loop, but no success :(
import joypy
import mplcursors
from matplotlib import cm
import matplotlib.pyplot as plt
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
x_range = list(range(len(data)))
fig, axes = joypy.joyplot(data, kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10))
axes[-1].set_xticks(x_range);
mplcursors.cursor(hover=True)
fig.savefig('joyplot.png', bbox_inches='tight')
What I have tried:
import joypy
from matplotlib import cm
import matplotlib.pyplot as plt
f, a = plt.subplots(2, 1)
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
for c, i in enumerate(range(0, len(data), 50)):
x_range = list(range(i, i+50, 1))
fig, axes = joypy.joyplot(data[i:i+50], kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10),
title="Emotion evolution over an interview")
# I don't know what to do here so the current fig can be added as subplot..
a[c].set_xticks(x_range);
fig.show()
Also, does anyone know how to make the plot interactive, as when my mouse hover over the plot then the its value of the y-axis appears. mplcursors
doesn't seem to work. Any help is appreciated! Thanks.
python matplotlib plot data-visualization
1
Your code is not runnable. How would you imagine someone to find out what "without success" means?
– ImportanceOfBeingErnest
Nov 16 '18 at 16:27
You're right. Sorry about that. I have edited the original question now. Thanks!
– Blue482
Nov 16 '18 at 17:24
1
I don't think you can use subplots. Even if subplots were possible, they would still take exactly the same space in the figure, right? So what exactly would be the desired outcome?
– ImportanceOfBeingErnest
Nov 16 '18 at 17:39
1
I think I understand what you are trying to do. But why? Where is the difference between having 6 curves below each other compared to having 2 times 3 curves below each other? Anyways, withjoypy
you cannot create subplots. So if you want to tell how the final plot is supposed to look like, one can probably provide a solution without the use of joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 17:59
1
No there isn't. Two options: (a) modify the joypy source code (b) don't use joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 18:26
|
show 4 more comments
I have been using joypy for plotting what is called ridgeline/joy plots. I want to divide my dataframe equally into several parts, and recursively making each one of them as joy plot and adding them altogether for the ease of visualisation. Without doing so I just get one very long plot which is difficult to view. I have tried using subplots
and making a new joypy.joyplot
within a for-loop, but no success :(
import joypy
import mplcursors
from matplotlib import cm
import matplotlib.pyplot as plt
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
x_range = list(range(len(data)))
fig, axes = joypy.joyplot(data, kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10))
axes[-1].set_xticks(x_range);
mplcursors.cursor(hover=True)
fig.savefig('joyplot.png', bbox_inches='tight')
What I have tried:
import joypy
from matplotlib import cm
import matplotlib.pyplot as plt
f, a = plt.subplots(2, 1)
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
for c, i in enumerate(range(0, len(data), 50)):
x_range = list(range(i, i+50, 1))
fig, axes = joypy.joyplot(data[i:i+50], kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10),
title="Emotion evolution over an interview")
# I don't know what to do here so the current fig can be added as subplot..
a[c].set_xticks(x_range);
fig.show()
Also, does anyone know how to make the plot interactive, as when my mouse hover over the plot then the its value of the y-axis appears. mplcursors
doesn't seem to work. Any help is appreciated! Thanks.
python matplotlib plot data-visualization
I have been using joypy for plotting what is called ridgeline/joy plots. I want to divide my dataframe equally into several parts, and recursively making each one of them as joy plot and adding them altogether for the ease of visualisation. Without doing so I just get one very long plot which is difficult to view. I have tried using subplots
and making a new joypy.joyplot
within a for-loop, but no success :(
import joypy
import mplcursors
from matplotlib import cm
import matplotlib.pyplot as plt
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
x_range = list(range(len(data)))
fig, axes = joypy.joyplot(data, kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10))
axes[-1].set_xticks(x_range);
mplcursors.cursor(hover=True)
fig.savefig('joyplot.png', bbox_inches='tight')
What I have tried:
import joypy
from matplotlib import cm
import matplotlib.pyplot as plt
f, a = plt.subplots(2, 1)
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
for c, i in enumerate(range(0, len(data), 50)):
x_range = list(range(i, i+50, 1))
fig, axes = joypy.joyplot(data[i:i+50], kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10),
title="Emotion evolution over an interview")
# I don't know what to do here so the current fig can be added as subplot..
a[c].set_xticks(x_range);
fig.show()
Also, does anyone know how to make the plot interactive, as when my mouse hover over the plot then the its value of the y-axis appears. mplcursors
doesn't seem to work. Any help is appreciated! Thanks.
python matplotlib plot data-visualization
python matplotlib plot data-visualization
edited Nov 16 '18 at 17:45
Blue482
asked Nov 16 '18 at 15:51
Blue482Blue482
1,06821429
1,06821429
1
Your code is not runnable. How would you imagine someone to find out what "without success" means?
– ImportanceOfBeingErnest
Nov 16 '18 at 16:27
You're right. Sorry about that. I have edited the original question now. Thanks!
– Blue482
Nov 16 '18 at 17:24
1
I don't think you can use subplots. Even if subplots were possible, they would still take exactly the same space in the figure, right? So what exactly would be the desired outcome?
– ImportanceOfBeingErnest
Nov 16 '18 at 17:39
1
I think I understand what you are trying to do. But why? Where is the difference between having 6 curves below each other compared to having 2 times 3 curves below each other? Anyways, withjoypy
you cannot create subplots. So if you want to tell how the final plot is supposed to look like, one can probably provide a solution without the use of joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 17:59
1
No there isn't. Two options: (a) modify the joypy source code (b) don't use joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 18:26
|
show 4 more comments
1
Your code is not runnable. How would you imagine someone to find out what "without success" means?
– ImportanceOfBeingErnest
Nov 16 '18 at 16:27
You're right. Sorry about that. I have edited the original question now. Thanks!
– Blue482
Nov 16 '18 at 17:24
1
I don't think you can use subplots. Even if subplots were possible, they would still take exactly the same space in the figure, right? So what exactly would be the desired outcome?
– ImportanceOfBeingErnest
Nov 16 '18 at 17:39
1
I think I understand what you are trying to do. But why? Where is the difference between having 6 curves below each other compared to having 2 times 3 curves below each other? Anyways, withjoypy
you cannot create subplots. So if you want to tell how the final plot is supposed to look like, one can probably provide a solution without the use of joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 17:59
1
No there isn't. Two options: (a) modify the joypy source code (b) don't use joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 18:26
1
1
Your code is not runnable. How would you imagine someone to find out what "without success" means?
– ImportanceOfBeingErnest
Nov 16 '18 at 16:27
Your code is not runnable. How would you imagine someone to find out what "without success" means?
– ImportanceOfBeingErnest
Nov 16 '18 at 16:27
You're right. Sorry about that. I have edited the original question now. Thanks!
– Blue482
Nov 16 '18 at 17:24
You're right. Sorry about that. I have edited the original question now. Thanks!
– Blue482
Nov 16 '18 at 17:24
1
1
I don't think you can use subplots. Even if subplots were possible, they would still take exactly the same space in the figure, right? So what exactly would be the desired outcome?
– ImportanceOfBeingErnest
Nov 16 '18 at 17:39
I don't think you can use subplots. Even if subplots were possible, they would still take exactly the same space in the figure, right? So what exactly would be the desired outcome?
– ImportanceOfBeingErnest
Nov 16 '18 at 17:39
1
1
I think I understand what you are trying to do. But why? Where is the difference between having 6 curves below each other compared to having 2 times 3 curves below each other? Anyways, with
joypy
you cannot create subplots. So if you want to tell how the final plot is supposed to look like, one can probably provide a solution without the use of joypy.– ImportanceOfBeingErnest
Nov 16 '18 at 17:59
I think I understand what you are trying to do. But why? Where is the difference between having 6 curves below each other compared to having 2 times 3 curves below each other? Anyways, with
joypy
you cannot create subplots. So if you want to tell how the final plot is supposed to look like, one can probably provide a solution without the use of joypy.– ImportanceOfBeingErnest
Nov 16 '18 at 17:59
1
1
No there isn't. Two options: (a) modify the joypy source code (b) don't use joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 18:26
No there isn't. Two options: (a) modify the joypy source code (b) don't use joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 18:26
|
show 4 more comments
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%2f53341265%2frecursively-adding-joypy-joyplot-as-subplot-to-one-matplotlib-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%2f53341265%2frecursively-adding-joypy-joyplot-as-subplot-to-one-matplotlib-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
1
Your code is not runnable. How would you imagine someone to find out what "without success" means?
– ImportanceOfBeingErnest
Nov 16 '18 at 16:27
You're right. Sorry about that. I have edited the original question now. Thanks!
– Blue482
Nov 16 '18 at 17:24
1
I don't think you can use subplots. Even if subplots were possible, they would still take exactly the same space in the figure, right? So what exactly would be the desired outcome?
– ImportanceOfBeingErnest
Nov 16 '18 at 17:39
1
I think I understand what you are trying to do. But why? Where is the difference between having 6 curves below each other compared to having 2 times 3 curves below each other? Anyways, with
joypy
you cannot create subplots. So if you want to tell how the final plot is supposed to look like, one can probably provide a solution without the use of joypy.– ImportanceOfBeingErnest
Nov 16 '18 at 17:59
1
No there isn't. Two options: (a) modify the joypy source code (b) don't use joypy.
– ImportanceOfBeingErnest
Nov 16 '18 at 18:26