Plot values of matrixplot as well as the matrixplot itself inside Manipulate
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
Given a MatrixPlot
inside a Manipulate
, say some $M(t)$ where $M_ij$ real for all entries, is there a way to show the values of each $M_ij$ inside matrix plot whilst the Manipulate
runs?
graphics matrix
add a comment |
up vote
4
down vote
favorite
Given a MatrixPlot
inside a Manipulate
, say some $M(t)$ where $M_ij$ real for all entries, is there a way to show the values of each $M_ij$ inside matrix plot whilst the Manipulate
runs?
graphics matrix
Possible duplicate mathematica.stackexchange.com/questions/9884/…
– Okkes Dulgerci
2 hours ago
Possible duplicate of ArrayPlot with cells labeled by corresponding values
– Edmund
1 hour ago
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Given a MatrixPlot
inside a Manipulate
, say some $M(t)$ where $M_ij$ real for all entries, is there a way to show the values of each $M_ij$ inside matrix plot whilst the Manipulate
runs?
graphics matrix
Given a MatrixPlot
inside a Manipulate
, say some $M(t)$ where $M_ij$ real for all entries, is there a way to show the values of each $M_ij$ inside matrix plot whilst the Manipulate
runs?
graphics matrix
graphics matrix
edited 1 hour ago
kglr
170k8193397
170k8193397
asked 3 hours ago
MKF
1314
1314
Possible duplicate mathematica.stackexchange.com/questions/9884/…
– Okkes Dulgerci
2 hours ago
Possible duplicate of ArrayPlot with cells labeled by corresponding values
– Edmund
1 hour ago
add a comment |
Possible duplicate mathematica.stackexchange.com/questions/9884/…
– Okkes Dulgerci
2 hours ago
Possible duplicate of ArrayPlot with cells labeled by corresponding values
– Edmund
1 hour ago
Possible duplicate mathematica.stackexchange.com/questions/9884/…
– Okkes Dulgerci
2 hours ago
Possible duplicate mathematica.stackexchange.com/questions/9884/…
– Okkes Dulgerci
2 hours ago
Possible duplicate of ArrayPlot with cells labeled by corresponding values
– Edmund
1 hour ago
Possible duplicate of ArrayPlot with cells labeled by corresponding values
– Edmund
1 hour ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
Here is using Graphics
SeedRandom@2;
matrix = RandomInteger[10, 5, 5];
MatrixForm@matrix
$left(beginarrayccccc
8 & 4 & 5 & 4 & 7 \
4 & 0 & 1 & 0 & 4 \
3 & 7 & 3 & 0 & 2 \
7 & 8 & 7 & 9 & 3 \
6 & 2 & 3 & 8 & 9 \
endarrayright)$
data = Join @@ Reverse@Table[i, j, j, 5, i, 1, 5];
values = Flatten@matrix;
minMax = MinMax@values;
data2 = Flatten /@ Partition[Riffle[values, data], 2];
Legended[Graphics[EdgeForm[Black],
ColorData["DarkRainbow"][Rescale[First[#], minMax]],
Rectangle[Rest[#]], Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2],
BarLegend["DarkRainbow", minMax]]
If you want to use MatrixPlot
Overlay[MatrixPlot[matrix, PlotRangePadding -> None,
ImagePadding -> None],
Graphics[Opacity@0, Rectangle[Rest[#]], Opacity@1, Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2,
PlotRangePadding -> None]]
add a comment |
up vote
2
down vote
Using a Slider
to change the dimensions of the matrix and EventHandler
to increase (left mouse click) / decrease (right mouse click) values of matrix elements:
DynamicModule[m = ConstantArray[0, 20, 20],
Manipulate[mat = m[[;; n, ;; n]];
Dynamic@EventHandler[
MatrixPlot[mat, Mesh -> All, ImageSize -> 1 -> 50,
DataReversed -> True,
Epilog -> Dynamic[MapIndexed[Text[Style[#, Large], Reverse@#2 - .5] &, mat, 2]]],
"MouseClicked", 1 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] += 1],
"MouseClicked", 2 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] -= 1]],
n, 5, 2, 20, 1]]
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Here is using Graphics
SeedRandom@2;
matrix = RandomInteger[10, 5, 5];
MatrixForm@matrix
$left(beginarrayccccc
8 & 4 & 5 & 4 & 7 \
4 & 0 & 1 & 0 & 4 \
3 & 7 & 3 & 0 & 2 \
7 & 8 & 7 & 9 & 3 \
6 & 2 & 3 & 8 & 9 \
endarrayright)$
data = Join @@ Reverse@Table[i, j, j, 5, i, 1, 5];
values = Flatten@matrix;
minMax = MinMax@values;
data2 = Flatten /@ Partition[Riffle[values, data], 2];
Legended[Graphics[EdgeForm[Black],
ColorData["DarkRainbow"][Rescale[First[#], minMax]],
Rectangle[Rest[#]], Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2],
BarLegend["DarkRainbow", minMax]]
If you want to use MatrixPlot
Overlay[MatrixPlot[matrix, PlotRangePadding -> None,
ImagePadding -> None],
Graphics[Opacity@0, Rectangle[Rest[#]], Opacity@1, Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2,
PlotRangePadding -> None]]
add a comment |
up vote
2
down vote
Here is using Graphics
SeedRandom@2;
matrix = RandomInteger[10, 5, 5];
MatrixForm@matrix
$left(beginarrayccccc
8 & 4 & 5 & 4 & 7 \
4 & 0 & 1 & 0 & 4 \
3 & 7 & 3 & 0 & 2 \
7 & 8 & 7 & 9 & 3 \
6 & 2 & 3 & 8 & 9 \
endarrayright)$
data = Join @@ Reverse@Table[i, j, j, 5, i, 1, 5];
values = Flatten@matrix;
minMax = MinMax@values;
data2 = Flatten /@ Partition[Riffle[values, data], 2];
Legended[Graphics[EdgeForm[Black],
ColorData["DarkRainbow"][Rescale[First[#], minMax]],
Rectangle[Rest[#]], Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2],
BarLegend["DarkRainbow", minMax]]
If you want to use MatrixPlot
Overlay[MatrixPlot[matrix, PlotRangePadding -> None,
ImagePadding -> None],
Graphics[Opacity@0, Rectangle[Rest[#]], Opacity@1, Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2,
PlotRangePadding -> None]]
add a comment |
up vote
2
down vote
up vote
2
down vote
Here is using Graphics
SeedRandom@2;
matrix = RandomInteger[10, 5, 5];
MatrixForm@matrix
$left(beginarrayccccc
8 & 4 & 5 & 4 & 7 \
4 & 0 & 1 & 0 & 4 \
3 & 7 & 3 & 0 & 2 \
7 & 8 & 7 & 9 & 3 \
6 & 2 & 3 & 8 & 9 \
endarrayright)$
data = Join @@ Reverse@Table[i, j, j, 5, i, 1, 5];
values = Flatten@matrix;
minMax = MinMax@values;
data2 = Flatten /@ Partition[Riffle[values, data], 2];
Legended[Graphics[EdgeForm[Black],
ColorData["DarkRainbow"][Rescale[First[#], minMax]],
Rectangle[Rest[#]], Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2],
BarLegend["DarkRainbow", minMax]]
If you want to use MatrixPlot
Overlay[MatrixPlot[matrix, PlotRangePadding -> None,
ImagePadding -> None],
Graphics[Opacity@0, Rectangle[Rest[#]], Opacity@1, Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2,
PlotRangePadding -> None]]
Here is using Graphics
SeedRandom@2;
matrix = RandomInteger[10, 5, 5];
MatrixForm@matrix
$left(beginarrayccccc
8 & 4 & 5 & 4 & 7 \
4 & 0 & 1 & 0 & 4 \
3 & 7 & 3 & 0 & 2 \
7 & 8 & 7 & 9 & 3 \
6 & 2 & 3 & 8 & 9 \
endarrayright)$
data = Join @@ Reverse@Table[i, j, j, 5, i, 1, 5];
values = Flatten@matrix;
minMax = MinMax@values;
data2 = Flatten /@ Partition[Riffle[values, data], 2];
Legended[Graphics[EdgeForm[Black],
ColorData["DarkRainbow"][Rescale[First[#], minMax]],
Rectangle[Rest[#]], Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2],
BarLegend["DarkRainbow", minMax]]
If you want to use MatrixPlot
Overlay[MatrixPlot[matrix, PlotRangePadding -> None,
ImagePadding -> None],
Graphics[Opacity@0, Rectangle[Rest[#]], Opacity@1, Black,
Text[First[#], Rest[#] + 0.5, 0.5] & /@ data2,
PlotRangePadding -> None]]
answered 2 hours ago
Okkes Dulgerci
3,4461716
3,4461716
add a comment |
add a comment |
up vote
2
down vote
Using a Slider
to change the dimensions of the matrix and EventHandler
to increase (left mouse click) / decrease (right mouse click) values of matrix elements:
DynamicModule[m = ConstantArray[0, 20, 20],
Manipulate[mat = m[[;; n, ;; n]];
Dynamic@EventHandler[
MatrixPlot[mat, Mesh -> All, ImageSize -> 1 -> 50,
DataReversed -> True,
Epilog -> Dynamic[MapIndexed[Text[Style[#, Large], Reverse@#2 - .5] &, mat, 2]]],
"MouseClicked", 1 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] += 1],
"MouseClicked", 2 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] -= 1]],
n, 5, 2, 20, 1]]
add a comment |
up vote
2
down vote
Using a Slider
to change the dimensions of the matrix and EventHandler
to increase (left mouse click) / decrease (right mouse click) values of matrix elements:
DynamicModule[m = ConstantArray[0, 20, 20],
Manipulate[mat = m[[;; n, ;; n]];
Dynamic@EventHandler[
MatrixPlot[mat, Mesh -> All, ImageSize -> 1 -> 50,
DataReversed -> True,
Epilog -> Dynamic[MapIndexed[Text[Style[#, Large], Reverse@#2 - .5] &, mat, 2]]],
"MouseClicked", 1 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] += 1],
"MouseClicked", 2 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] -= 1]],
n, 5, 2, 20, 1]]
add a comment |
up vote
2
down vote
up vote
2
down vote
Using a Slider
to change the dimensions of the matrix and EventHandler
to increase (left mouse click) / decrease (right mouse click) values of matrix elements:
DynamicModule[m = ConstantArray[0, 20, 20],
Manipulate[mat = m[[;; n, ;; n]];
Dynamic@EventHandler[
MatrixPlot[mat, Mesh -> All, ImageSize -> 1 -> 50,
DataReversed -> True,
Epilog -> Dynamic[MapIndexed[Text[Style[#, Large], Reverse@#2 - .5] &, mat, 2]]],
"MouseClicked", 1 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] += 1],
"MouseClicked", 2 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] -= 1]],
n, 5, 2, 20, 1]]
Using a Slider
to change the dimensions of the matrix and EventHandler
to increase (left mouse click) / decrease (right mouse click) values of matrix elements:
DynamicModule[m = ConstantArray[0, 20, 20],
Manipulate[mat = m[[;; n, ;; n]];
Dynamic@EventHandler[
MatrixPlot[mat, Mesh -> All, ImageSize -> 1 -> 50,
DataReversed -> True,
Epilog -> Dynamic[MapIndexed[Text[Style[#, Large], Reverse@#2 - .5] &, mat, 2]]],
"MouseClicked", 1 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] += 1],
"MouseClicked", 2 :> With[p = Reverse @ Ceiling @ MousePosition["Graphics"],
m[[## & @@ p]] -= 1]],
n, 5, 2, 20, 1]]
edited 1 hour ago
answered 1 hour ago
kglr
170k8193397
170k8193397
add a comment |
add a comment |
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f185720%2fplot-values-of-matrixplot-as-well-as-the-matrixplot-itself-inside-manipulate%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Possible duplicate mathematica.stackexchange.com/questions/9884/…
– Okkes Dulgerci
2 hours ago
Possible duplicate of ArrayPlot with cells labeled by corresponding values
– Edmund
1 hour ago