While trying to find a useful way having earthquakes displayed, I noticed that it isn't that easy to manage.

I'd like to be able to recognize the "Magnitude", "Date", and "Depth" from the style of the point. Something like:

  • size: based on magnitude
  • depth: basic color (ex. <15 red, 15-30 yellow, >30 blue)
  • date: intensity of color as shading from 100% color to white/...

Is there a way to do so without defining dozens of rules?

4 Answers 4


Why not using the rule-based labeling? You could ease up the task a lot, if you use categories for multiple gradients based on your attribute data. From my point of view using categories in rule-based labeling is one of the mayor advantages of QGIS.

For your data (without knowing the structure) i would recommend the following workflow:

  • Make a rule based simple gradient for your date-values via the categorized or graduated point styler (white or greyish style).
  • Adjust the size of the points by clicking on "advanced" and "size scaled field". Here select the magnitude of your points. Save the resulting style as SLD style!
  • Go to rule-based labeling, load jn your SLD and add for each data-point per rightclick a category (or range) with the color gradient of your liking for your depth and apply it to each ruleset.

Like this (you could also make a category on rules in a category ;-) ): enter image description here

  • Afterwards don't forget to adjust the rendering order and maybe control for the sizes of the points.

I understand that this solution depends on some effort (mouseclicks) on your site, but in the end a beautiful map is always worth the effort.


Thee other option is to use a size assistant that is available for each of the data layer style. Say you categorized your point data based on color using a certain attribute. Simply right click each category and select Change Size. It should display a size dialog box. Then click on the expression filter and then select Size Assistant.

enter image description here

The size assistant dialog box has option to choose the column to size by. You can also choose the scale method you want to scale your symbols by and then provide the range of sizes and the corresponding range of your data values. enter image description here Note you will need to do this for each category of your data.

  • I don't know why this answer isn't more voted- this is what I wanted, and it's by far the quickest Commented Nov 13, 2019 at 23:15
  • 1
    I didn't need to right-click each category. Simply select all categories and right-click on any to do it all at once.
    – Joooeey
    Commented May 25, 2023 at 10:47

Updated for QGIS 2.8

Assuming data like this:

id | magnitude | date | depth
 1 |     4     | 1912 |  100
 2 |     3     | 1932 |   85

Using data-defined styling, set the size to be controlled by the magnitude field.

For the color, which is defined by date and depth, you can use the following expression

  WHEN depth < 15 
       THEN color_hsl(1, 100, scale_linear(date, 1900, 2015, 100, 50)
  WHEN depth >= 15 AND depth < 30 
       THEN color_hsl(60, 100, scale_linear(date, 1900, 2015, 100, 50)
  WHEN depth >= 30 
       THEN color_hsl(240, 100, scale_linear(date, 1900, 2015, 100, 50)

"Old" points from 1900 will be white hsl(x,x,100) while new points are more colorful up to hsl(x,x,50).


@spatialthoughts runs a very nice tutorial site for qgis. He's changed the address since he originally posted many years ago, and an answer to this question can now be found at http://www.qgistutorials.com/en/docs/3/basic_vector_styling.html. He points out the same solution as @sherpas does here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.