How can I create an interactive Colorbar using Matplolib?












0














This is my sample code,here i want to create a interactive colorbar.When i clicked colorbar ranges,i want to update my plot. So can anyone please guide me how to create a interactive colorbar uisng with Matplotlib.
Given bellow is my code:



import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import Slider, Button, RadioButtons

fig = plt.figure()
ax = fig.add_subplot(111)
fig.subplots_adjust(left=0.25, bottom=0.25)
min0 = 0
max0 = 30000

im = max0 * np.random.random((10,10))
im1 = ax.imshow(im)

axcolor = 'lightgoldenrodyellow'

fig.colorbar(im1)


plt.show()


i found this link.It is in MATLAB(second example)but here i don't want to create any sliders, but colorbar i need to create as same in that example i want to move the range values then correspondingly it will update that plot.



https://mathematica.stackexchange.com/questions/64439/how-can-i-create-an-interactive-colorfunction-using-manipulate










share|improve this question






















  • Reading this question of the questioner seems prerequisite to understanding the above.
    – ImportanceOfBeingErnest
    Nov 20 at 13:13










  • Similar questions: Q1, Q2
    – ImportanceOfBeingErnest
    Nov 20 at 14:05










  • hello sir here i don 't want to use extra slider, in my colourbar i have a 0 to 255 range of colours are there.when i click any range of the colour in colorbar i want to change my plot according to that colour.but you are sending example in that there are using other slider max. that max slider is updated the plot but i want to do that in colorbar only. if you knew anything about this can you please help me
    – navya sri
    Nov 21 at 4:07










  • I do know a lot, but the problem is really more that I do not understand the question. So let's assume you have a colorbar and you can click into the colorbar at a certain position x. What is the expected outcome? In how far is this comment then not exactly what you need?
    – ImportanceOfBeingErnest
    Nov 21 at 4:12










  • when i click the colorbar position x ,then it will take that position value of the color according to that my plot will change
    – navya sri
    Nov 21 at 4:34
















0














This is my sample code,here i want to create a interactive colorbar.When i clicked colorbar ranges,i want to update my plot. So can anyone please guide me how to create a interactive colorbar uisng with Matplotlib.
Given bellow is my code:



import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import Slider, Button, RadioButtons

fig = plt.figure()
ax = fig.add_subplot(111)
fig.subplots_adjust(left=0.25, bottom=0.25)
min0 = 0
max0 = 30000

im = max0 * np.random.random((10,10))
im1 = ax.imshow(im)

axcolor = 'lightgoldenrodyellow'

fig.colorbar(im1)


plt.show()


i found this link.It is in MATLAB(second example)but here i don't want to create any sliders, but colorbar i need to create as same in that example i want to move the range values then correspondingly it will update that plot.



https://mathematica.stackexchange.com/questions/64439/how-can-i-create-an-interactive-colorfunction-using-manipulate










share|improve this question






















  • Reading this question of the questioner seems prerequisite to understanding the above.
    – ImportanceOfBeingErnest
    Nov 20 at 13:13










  • Similar questions: Q1, Q2
    – ImportanceOfBeingErnest
    Nov 20 at 14:05










  • hello sir here i don 't want to use extra slider, in my colourbar i have a 0 to 255 range of colours are there.when i click any range of the colour in colorbar i want to change my plot according to that colour.but you are sending example in that there are using other slider max. that max slider is updated the plot but i want to do that in colorbar only. if you knew anything about this can you please help me
    – navya sri
    Nov 21 at 4:07










  • I do know a lot, but the problem is really more that I do not understand the question. So let's assume you have a colorbar and you can click into the colorbar at a certain position x. What is the expected outcome? In how far is this comment then not exactly what you need?
    – ImportanceOfBeingErnest
    Nov 21 at 4:12










  • when i click the colorbar position x ,then it will take that position value of the color according to that my plot will change
    – navya sri
    Nov 21 at 4:34














0












0








0







This is my sample code,here i want to create a interactive colorbar.When i clicked colorbar ranges,i want to update my plot. So can anyone please guide me how to create a interactive colorbar uisng with Matplotlib.
Given bellow is my code:



import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import Slider, Button, RadioButtons

fig = plt.figure()
ax = fig.add_subplot(111)
fig.subplots_adjust(left=0.25, bottom=0.25)
min0 = 0
max0 = 30000

im = max0 * np.random.random((10,10))
im1 = ax.imshow(im)

axcolor = 'lightgoldenrodyellow'

fig.colorbar(im1)


plt.show()


i found this link.It is in MATLAB(second example)but here i don't want to create any sliders, but colorbar i need to create as same in that example i want to move the range values then correspondingly it will update that plot.



https://mathematica.stackexchange.com/questions/64439/how-can-i-create-an-interactive-colorfunction-using-manipulate










share|improve this question













This is my sample code,here i want to create a interactive colorbar.When i clicked colorbar ranges,i want to update my plot. So can anyone please guide me how to create a interactive colorbar uisng with Matplotlib.
Given bellow is my code:



import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import Slider, Button, RadioButtons

fig = plt.figure()
ax = fig.add_subplot(111)
fig.subplots_adjust(left=0.25, bottom=0.25)
min0 = 0
max0 = 30000

im = max0 * np.random.random((10,10))
im1 = ax.imshow(im)

axcolor = 'lightgoldenrodyellow'

fig.colorbar(im1)


plt.show()


i found this link.It is in MATLAB(second example)but here i don't want to create any sliders, but colorbar i need to create as same in that example i want to move the range values then correspondingly it will update that plot.



https://mathematica.stackexchange.com/questions/64439/how-can-i-create-an-interactive-colorfunction-using-manipulate







python-2.7 matplotlib






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 at 6:52









navya sri

826




826












  • Reading this question of the questioner seems prerequisite to understanding the above.
    – ImportanceOfBeingErnest
    Nov 20 at 13:13










  • Similar questions: Q1, Q2
    – ImportanceOfBeingErnest
    Nov 20 at 14:05










  • hello sir here i don 't want to use extra slider, in my colourbar i have a 0 to 255 range of colours are there.when i click any range of the colour in colorbar i want to change my plot according to that colour.but you are sending example in that there are using other slider max. that max slider is updated the plot but i want to do that in colorbar only. if you knew anything about this can you please help me
    – navya sri
    Nov 21 at 4:07










  • I do know a lot, but the problem is really more that I do not understand the question. So let's assume you have a colorbar and you can click into the colorbar at a certain position x. What is the expected outcome? In how far is this comment then not exactly what you need?
    – ImportanceOfBeingErnest
    Nov 21 at 4:12










  • when i click the colorbar position x ,then it will take that position value of the color according to that my plot will change
    – navya sri
    Nov 21 at 4:34


















  • Reading this question of the questioner seems prerequisite to understanding the above.
    – ImportanceOfBeingErnest
    Nov 20 at 13:13










  • Similar questions: Q1, Q2
    – ImportanceOfBeingErnest
    Nov 20 at 14:05










  • hello sir here i don 't want to use extra slider, in my colourbar i have a 0 to 255 range of colours are there.when i click any range of the colour in colorbar i want to change my plot according to that colour.but you are sending example in that there are using other slider max. that max slider is updated the plot but i want to do that in colorbar only. if you knew anything about this can you please help me
    – navya sri
    Nov 21 at 4:07










  • I do know a lot, but the problem is really more that I do not understand the question. So let's assume you have a colorbar and you can click into the colorbar at a certain position x. What is the expected outcome? In how far is this comment then not exactly what you need?
    – ImportanceOfBeingErnest
    Nov 21 at 4:12










  • when i click the colorbar position x ,then it will take that position value of the color according to that my plot will change
    – navya sri
    Nov 21 at 4:34
















Reading this question of the questioner seems prerequisite to understanding the above.
– ImportanceOfBeingErnest
Nov 20 at 13:13




Reading this question of the questioner seems prerequisite to understanding the above.
– ImportanceOfBeingErnest
Nov 20 at 13:13












Similar questions: Q1, Q2
– ImportanceOfBeingErnest
Nov 20 at 14:05




Similar questions: Q1, Q2
– ImportanceOfBeingErnest
Nov 20 at 14:05












hello sir here i don 't want to use extra slider, in my colourbar i have a 0 to 255 range of colours are there.when i click any range of the colour in colorbar i want to change my plot according to that colour.but you are sending example in that there are using other slider max. that max slider is updated the plot but i want to do that in colorbar only. if you knew anything about this can you please help me
– navya sri
Nov 21 at 4:07




hello sir here i don 't want to use extra slider, in my colourbar i have a 0 to 255 range of colours are there.when i click any range of the colour in colorbar i want to change my plot according to that colour.but you are sending example in that there are using other slider max. that max slider is updated the plot but i want to do that in colorbar only. if you knew anything about this can you please help me
– navya sri
Nov 21 at 4:07












I do know a lot, but the problem is really more that I do not understand the question. So let's assume you have a colorbar and you can click into the colorbar at a certain position x. What is the expected outcome? In how far is this comment then not exactly what you need?
– ImportanceOfBeingErnest
Nov 21 at 4:12




I do know a lot, but the problem is really more that I do not understand the question. So let's assume you have a colorbar and you can click into the colorbar at a certain position x. What is the expected outcome? In how far is this comment then not exactly what you need?
– ImportanceOfBeingErnest
Nov 21 at 4:12












when i click the colorbar position x ,then it will take that position value of the color according to that my plot will change
– navya sri
Nov 21 at 4:34




when i click the colorbar position x ,then it will take that position value of the color according to that my plot will change
– navya sri
Nov 21 at 4:34

















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


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387690%2fhow-can-i-create-an-interactive-colorbar-using-matplolib%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f53387690%2fhow-can-i-create-an-interactive-colorbar-using-matplolib%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







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?