From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Log scale in an Intensity graph

I have a question with regard to intensity graphs. I can plot both a linear scale and a log scale in an intensity graph. The range of values is from 0 to 127. However, when using a logarithmic scale the size of the marker values is not uniform and it does not allow me to see values larger than 10.  I mean the size of the following ranges:

0.001 to 0.01

0.01 to 0.1

0.1 to 1.0

and

1.0  to 10.0

is too big. Then, the space that is left for the remaining marker values is too small.

I want to resize the distance between each marker value so that it matches that that I have for the linear scale.

I have tried using the Uniform Marker Spacing option but it does not work. I also looked for information in the help file but so far I have not been able to find something that allows me so solve this problem.

I hope somebody can help me with this problem.

 

Roberto

0 Kudos
Message 1 of 9
(4,934 Views)
Hi Roberto,

what do you want to achieve?
Even more questions:
Why can't you set the range from 1e-3 to 127?
Which LabView version do you use?
Can you attach an example?

Suggestion:
You can set your own markers using property nodes. Have you tried this?


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(4,930 Views)

Thank you for your quick reply Gerd

GerdW:

 

With regard to your questions:

 

1)  what do you want to achieve?

I am using labview to see files that contain fluid velocity information. In some of my files the data can be visualized using a linear scale. However there are cases where the fluid velocity changes are large. i.e., near the wall of a pipe the velocity is much smaller than that at the center of the pipe. In cases like this having the opportunity to visualize the data using a log scale greatly improves the understanding of the flow.

 

2)  Why can't you set the range from 1e-3 to 127?

I used a linear scale originally and set a property node to read the minimum and maximum values of the data to plot. It turns out that those values are 0 and 127 (when I am only using positive values). I added extra markers because I wanted to have 16 different colors in my graph.

 

Then I used a case structure to change to log scale in cases when it is desired to see the data in this type of scale.

The data looks like a log scale but it kept the range of the linear scale. So the first range that goes from 0 to 8 occupies a big portion of the scale. Because the values 0.001, 0.01 and 0.1 and 1.0 are contained in it. Then I tried using the Clusters that are shown below the graph and wiring them to a property node. The 1D cluster on the LHS is for the linear scale and the 1D cluster on the RHS is for the log scale. These clusters were only used when the ONLY POSITIVE VALUES option was selected. The cluster on the RHS had a range from 0.001 to 127. I stopped using it because

a)      the scale looked like that of the log scale I am showing in this file, that is the range from 0.001 to 10 occupies most of the area of the color graph

b)      somehow the cluster did not keep the values even though I saved my file so I had to input the values when I opened the file

 

3)  Which LabView version do you use?

I am currently using version 8.2

 

4)  Can you attach an example?

I am attaching the file I just mentioned and a test file.

 

 

Download All
0 Kudos
Message 3 of 9
(4,919 Views)

We cannot really test your VI because of a missing subVI. I suggest that you

  1. Run your VI with some real data.
  2. Stop the VI
  3. Delete the subVI "Binary read UVP..."
  4. Right-click on "array copy" and "change to constant". This will create a diagram constant containing your current data.
  5. Repeat for "# of profiles".
  6. Save VI under a new name.
  7. Attach it again.

Some general comments.

  • It is not a good idea to delelet the label of the graph/chart and replace it with a diagram comment. Makes it difficult to associate property nodes (some of which now have a wrong label, confusing everyone).
  • One property node containing all properties is enough. Only the different values you write need to be inside the case structure.
  • You should ensure that the properties are only rewritten if they change, not at each iteration fo the loop. They are expensive.
  • I have no Idea about the purpose of the while loop in the upper right case structure.
  • I am not sure why you use local variables for "# of profiles" and "array min/max". The wire is right there.
  • Instead of multiplying a local variable with a zero diagram constant, just wire the zero to the property node, eliminating the local.
  • etc...
  • Since the loop count is fully determined before the loop starts and there is no interactive stop button or error check for premature termination, you should use a FOR loop instead. 
Message 4 of 9
(4,913 Views)

We cannot really test your VI because of a missing subVI. I suggest that you

  1. Run your VI with some real data.

  2. Stop the VI

  3. Delete the subVI "Binary read UVP..."

  4. Right-click on "array copy" and "change to constant". This will create a diagram constant containing your current data.

  5. Repeat for "# of profiles".

  6. Save VI under a new name.

  7. Attach it again.

Thank you for your suggestions Altenbach, I followed steps 1 through 8 and saved the Vi as Log Color Scale Modified, which I am attaching.

 

Some general comments.

a)       It is not a good idea to delete the label of the graph/chart and replace it with a diagram comment. Makes it difficult to associate property nodes (some of which now have a wrong label, confusing everyone).

b)       One property node containing all properties is enough. Only the different values you write need to be inside the case structure.

c)       You should ensure that the properties are only rewritten if they change, not at each iteration for the loop. They are expensive.

d)       I have no Idea about the purpose of the while loop in the upper right case structure.

e)       I am not sure why you use local variables for "# of profiles" and "array min/max". The wire is right there.

f)         Instead of multiplying a local variable with a zero diagram constant, just wire the zero to the property node, eliminating the local.

g)       etc...

h)       Since the loop count is fully determined before the loop starts and there is no interactive stop button or error check for premature termination, you should use a FOR loop instead. 

 

Also, I addressed your comments (a through h) and the Vi seems to be running faster and smoother. I will keep all of these points in mind for future reference.

For item h) I did try to use a for loop but the vi did not work, I am not sure why so I decided to leave the while loop for now and take care of this later.

 

Here is the Vi. Thanks again,

Roberto

0 Kudos
Message 5 of 9
(4,903 Views)
OK, here's a quick rewrite using a FOR loop. I think you should use the "Makervals[]" property to set the colors for the various z-values.
 
Of course you can generate the "markervals[]" programmatically depending on array max and min. Of course you might want to use more colors. Modify as needed.
Message 6 of 9
(4,893 Views)

Thanks a lot Altenbach,

This Vi looks very  compact and efficient. I thik I will use the "Makervals[]" property node to set the color scale. I will most probably need to set them programatically because every file has a differrent number of channels and a different number of profiles to plot.

I have been trying to get set this option programatically so I will continue working on it.

Thanks again for your assistance,

Roberto

0 Kudos
Message 7 of 9
(4,881 Views)

Hello,

I know that this post is old, but i really need to put the X and Y scale in Logarithm.

Anyone did That???

I have my .vi in attach. I want to have the scale of the XY graph in the intensity Graph.
It's possible? Someone has the solution for that?

0 Kudos
Message 8 of 9
(3,978 Views)

You got the graph to look quite nice. What I would do is just label the axis as Log(time) or Ln(Time)... (or whatever the units are) and set x0 and dx according to the scaling. (I probably would also use log10 instead of ln, etc.)

 

Workarounds with a real log axis scale would be to a bit clumsy with the current tools (e.g. hide the scale and overlay the scale of a hidden slider, for example. Or you could create a copy of the xy graph and place it in the background without data, then overlay the frameless intensity graph.

 

(Note that if we had this idea implemented, we could have arbitrary text or numbers for each marker and then all this would be quite simple to implement. Please vote for it! :D)

 

Anyway, I would recommend to use the "in place element structure" to do the 2D histogram, dramatically simplifies the code (see picture).

 

 

 

0 Kudos
Message 9 of 9
(3,962 Views)