[SOLVED] Setting "w" in db for plot and calculations

Here you can report the problems encountered with the graphical functions (db.plot, vario.plot, ...)

[SOLVED] Setting "w" in db for plot and calculations

Postby bethyp » Wed Mar 09, 2016 10:55 pm

Dear RGeoS Developers and Users,

I'm creating a db and setting a field to "w" to use as weighting for calculating CG, I and GIC. I set the field to "w" using the code:

anch.db <- db.locate(anch.db,12,"w")

When I check, field 12 (CPUE) is indeed weighted (listed with "w" for Locator). However, when I go to plot the data, using simply:


The point sizes are not weighted by CPUE (they are all the same size and small). I can't figure out why the "w" isn't being used in the plot call (it worked for a previous plot with identical settings).

Is there 1) a way to manually weight the size of the points by "w" (e.g., "cex") for a db? or 2) a step that I am missing to ensure the weights are being incorporated in calculations?

The plots were really just a check for me, but now I am concerned that the weighted variable isn't being used when calculating CG either.

I attached the plots for your reference.

Thanks in advance,


Anch_w.jpeg (23.96 KiB) Viewed 617 times
Anch_nw.jpeg (23.12 KiB) Viewed 617 times
Posts: 2
Joined: Thu Mar 03, 2016 8:28 pm

Re: Setting "w" in db for plot and calculations

Postby Didier Renard » Mon Mar 28, 2016 8:48 pm


My first answer if that indeed the weight (when defined as a "w" locator for a given attribute) is considered as a weight taken into account for the calculations of all spatial indices.

My second answer is that NO, the weight ("w" locator) is NOT used during the plot. The standard plot function is using the target variable (locator "z") to provide a proportional display. It would be confusing to add the contribution of a second variable.

Moreover, when using the plot facility, the display by default represents the target variable in proportional representation. However, the user can modify the represented variable by using the 'name' argument.

Let me illustrate this by a pseudo-example:

Let us imagine that we have a db (called 'mydb') with the following attributes:
1: Sample rank (locator rank)
2: Coordinate along X (locator x1)
3: Coordinate along Y (locator x2)
4: Variable ... say "length" (locator z1)
5: Variable weight (locator W)

When using plot(mydb), the display represents variable "length" with proportional symbols
When using plot(mydb,name=5), the display represents the variable "weight".

Hope this will help.
Didier Renard
Posts: 265
Joined: Thu Sep 20, 2012 4:22 pm

Re: [SOLVED] Setting "w" in db for plot and calculations

Postby bethyp » Tue Dec 13, 2016 10:09 pm

Apologies for my delayed response.

This was very helpful, and reassuring!

Posts: 2
Joined: Thu Mar 03, 2016 8:28 pm

Return to Graphical representation

Who is online

Users browsing this forum: No registered users and 1 guest