# Thread: graphing logarithmic data

1. Intermediate user
Join Date
Apr 2007
Location
Rakovnik, Czech Republic
Posts
175
Thanks
43
Thanked 3 Times in 3 Posts
Qt products
Platforms

## graphing logarithmic data

I have a custom widget that uses data from Well Logs to draw skwiggle lines with a paintEvent() like shown in the attached image.

In this image there are 3 separate graphs: 1) the one on the left with red, black, and blue lines, 2)the one on the right with just the blue and red lines, and 3) the one in the middle with 3 different green/light blue lines. The data for the left and right graph are linear (#1 and #3); the data for the middle graph are logarithmic. This is what I need help with.

The width of my rectangle where I'm drawing the skwiggle lines is 100 pixels. If I want to draw a skiggle line for a Well Log attribute that is LINEAR with a data range of 0 through 200, I calculate the X location like so:

xLocationInGraph = int( (attributeValue / 200) * 100 );

So if the attribute is low--10, for example--that part of the skwiggle line will be close to the left side of the rectangle: 10 / 200 * 100 = 5. If the attribute is at the higher end of the data range--170, for example--that part of the skwiggle line will be close to the right side of the rectangle: 170 / 200 * 100 = 85. This is easy/straight-forward.

But I don't know how to do this for logarithmic data. In the attached image, the data range is .2 to 2000 (the middle, logarithmic graph). This is similar to my data (the ranges will be either .2-20, or .2-200, or .2-2000). My questions are:

1. In the attached image, in the central graph (the logarithmic graph), is the far left line .2? And the next weighted line to the right 2? And the next 20? And the next 200? And the next 2000? If so, what is the value of the space between this last weighted line--2000--and the right side of the graph? There's a relatively wide spacing here... which looks like it should be all the way over to the left side of the graph. I've seen other graphs similar to this; why?

2. How do I convert from the logarithmic data values to xLocationInGraph values? For example, the Well Log data values might look like this:

.22
.49
1.78
1300.27
26.83
.88

....which I need to convert to x values between 0 and 100... so they'll plot on my graph widget. How to do this?

Thank you!

2. Intermediate user
Join Date
Apr 2007
Location
Rakovnik, Czech Republic
Posts
175
Thanks
43
Thanked 3 Times in 3 Posts
Qt products
Platforms

## Re: graphing logarithmic data

NEVERMIND!! i figured it out.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.