Drupal: Subtitles in views - drupal

I made a product content type with following fields: Name, price, categorie (taxonomy)
I then used views to make a simple pricelist.
White bread
Brown bread
Chocolate cake
Strawberry pie
The bread has "Bread" as categorie, the chocolate cake and strawberry pie have "pie" as categorie. I ordened the product list using this category so that all the bread and all the pie are together. What I want to do now is having a subtitle with the categorie everytime a new categorie begins.
Like this
Bread
White Bread € 2.50
Brown Bread € 2.70
Cake
Chocolate cake € 7.00
Strawberry cake € 10.00
I can't seem to find anywhere how to do that easily.
Any of you guys have an idea? Is there a way to do this withouth needing tot make my own module?

I just found it myself after some logic thinking. I am going to post the answer here if anyone should need this.
I added category (taxonomy) to my fields and excluded it from display.
Then I went to settings next to grid and used Categorie for Grouping nr. 1

Related

How to display the total on a bar graph as the input changes in r shinyapp

I am working on an app, and right now I want to compare two NBA players' career totals on a bar graph as I pick and choose which players will be compared. For example, when I select Michael Jordan and LeBron James, and career points, I want a bar graph that displays 32,292 for Michael Jordan, and 35,618, but if I were to swap LeBron James out for Kareem Abdul-Jabbar, I would like the bar graph to display 38,387. The ability to change the inputs has been taken care of, and the data set needed to do this is implemented. I just need help figuring out how to have geom_text(aes_string(label = *)) * change given different inputs in my ggplot.

Using R to extract a specific colour from an image

I'm new to both Stackoverflow and coding in general, but I hope I can find some answers here.
For an assignment in computational art history, I want to find a way in RStudio that can display a specific colour in an image, leaving the rest in greyscale.
Like how this photo looks, only detecting the blue from the image
What I want to end up achieving is uploading an image of a painting, and showing that a specific type of blue (rgb(65,102,245) or 'ultramarine') was used by Johannes Vermeer and locating it on his Girl with the Pearl Earring. I can do it with .tif or any other format.
I've tried RGB rasters like described here but I ended up getting errors when I tried to perform it with my own photo (like "alpha level NA, not in [0,1]"). Perhaps I can try that again and show where I go wrong - but to be frank any help/support is welcome at this point!
Best, Doris

Combine Languages in pie chart

Under Audience->Geo->Language I see many country codes:
1. fr
2. fr-fr
3. en-us
4. fr-ch
5. en-gb
6. de
7. ...
....
etc.
I would like to combine these similar country codes with regex fr($|[-_])
into a pie chart.
So only fr-*,en-,de-,it- wil show on that pie with % values. Something like fr ist 30%, en is 28% etc.
A widget would be great.
I was able to create a segments, that will list these values. But not together in a pie chart.
Screenshot
You probably have to create a new View on the Property with a "search and replace" filter on the view to transform all French types into a single French type.
Your View configuration might look something like this:
You should then be able to pull pie chart reports on these languages via your basic Geo > Language reports.
There is the pie chart in the view next to advanced, view attached. But I might not be understanding what you want?

Taxonomy top level terms (plus other fields) in views block

I have a term reference field on a content type. The vocabulary has two levels. I need to be able to show only the top level terms.
What is saved in the field:
X Fruit
X Apple
X Orange
- Veggie
- Carrot
- Green Bean
X Candy
- Lollypop
- Chocolate
What I want:
Title: The Title
Categories: Fruit, Candy
Another Field: data
What I get:
Title: The Title
Categories: Fruit, Apple, Orange, Candy
Another Field: data
I am even fine with getting them all back but at least having the distinction what is top level so I can hide the others. I am trying to do this in a views block. I found answers on how to do this if I only wanted the terms, but I need more data from the node then that.
After sucking up way to many hours on this project... I got it working by modifying the Hierarchical Term Formatter module: https://drupal.org/project/hierarchical_term_formatter
By telling it to show only top level term, it would give me a list like this: Fruit, Fruit, Fruit, Candy
I went in and added a line to remove duplicate array values (using code I found here: How to remove duplicate values from a multi-dimensional array in PHP). I added it right about the return for hierarchical_term_formatter_field_formatter_view .
I now get the result I was looking for: Fruit, Candy
(PS I am not sure how I submit this to the creator of the module. I don't think it's necessarily a bug, but it could expand it's uses. I do not have experience in community coding projects.)

Representing a "radiomatrix" question from a survey

Hi I am making a report of a survey where we have what we call a "radiomatrix" and it looks like this.
alt text http://img193.imageshack.us/img193/9288/radiomatrix.png
Then we import the answers is a table in R into something that looks like this:
user tiramisu cupcake chocolate carrot
test01 loves_it loves_it loves_it hate_it
test02 likes_it likes_it loves_it likes_it
test03 likes_it loves_it loves_it hate_it
What would be the best and most meaningful graphical representation for this?
One of the things I would do is to constract a contingency table and then perform correspondence analysis (look fot it here), to produce something like this
Another one is that I would try to show correlations between preferences (something like this)
Perhaps one could also mine association rules, e.g.
If Loves Tiramisu then hates Cupcake
If you would like to create mosaic plots with R, check out this.
There isn't a "best" representation for any given set of data. It depends on what you're trying to show. Some examples:
If you want to test the hypothesis that people are extreme about their cake preferences -- that is, that there are very few likes vs. loves/hates -- you could show a plot of preference intensity versus quantity.
If you want to show that chocolate is more preferred than tiramisu, you could use a simple table that assigns -1 to "hate", 0 to "like", and 1 to "love" to come up with a mean/median score for each dessert.
A mosaic plot might be interesting. See here (PDF) for examples.

Resources