Message Boards Message Boards

0
|
5244 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Get a scaleable colorbar with ListVectorPlot in Mathematica?

Posted 4 years ago

I am plotting some vector plots with the ListVectorPlot function with VectorColorFunction being "Rainbow". What I want is to scale the colorbar as per my requirements so that I can get varied colour for different values of vector magnitude. How to incorporate this into my code?. I am writing the part of my code with ListVectorPlot.

streamData = 
 Table [ { datax[[i, n - j + 1]], datay[[i, n - j + 1]]}, {i, 1, m}, {j, 1, n}];

 ListVectorPlot [ streamData, StreamPoints -> 250, 
 Frame -> False, VectorPoints -> All, Axes -> True, VectorColorFunction -> "Rainbow"]

Thanks in advance.

POSTED BY: S Banerjee
5 Replies
Manipulate[
 ListVectorPlot[data, StreamPoints -> 250, Frame -> False, 
  VectorPoints -> All, Axes -> True, 
  VectorColorFunctionScaling -> False,
  VectorColorFunction -> (ColorData["Rainbow", 
      Rescale[#5, {min, max}]] &)
  ],
 {{min, 2.5}, 0, 2.5},
 {{max, 5}, 2.5, 5}
 ]
POSTED BY: Martijn Froeling
Posted 4 years ago

I have already input my data into datax and datay... I have not posted those lines here.

POSTED BY: S Banerjee
Posted 4 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi
Posted 4 years ago

But what is the answer?

POSTED BY: S Banerjee

Hi, I think it is better if you "create" some data first, like below:

datax = Table[{i, 60 - j + 1}, {i, 10}, {j, 15}];
datay = Table[{i, 60 - j + 1}, {i, 10}, {j, 15}];
streamData = {datax, datay};

ListVectorPlot[streamData, StreamPoints -> 250, Frame -> False, 
 VectorPoints -> All, Axes -> True, VectorColorFunction -> "Rainbow"]

Best regards Christos

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract