I created a stacked bar plot which depicts the distribution of council seats (= y-axis) among parties within a municipality over several years (= x-axis). The used code and some data is below. Unfortunately, I don't have yet sufficient points to post the graph.
The different parties are also associated with a variable called "ideology" as a category for different political orientations ("progressive", "moderate", "conservative").
I would like to modify the colors in such a way that all e.g. conservative parties have different kinds of blues; all progressive parties different kinds of green; and all moderate parties e.g. different kinds of red;
The variable on the ideology is in the same dataframe (y).
Any hint how to get this modification? I already tried color=factor(ideology) and group=ideology but to no avail. I am also aware of this related entry Using a pre-defined color palette in ggplot however it doesn't pertain specifically to my problem.
Many thanks.
Used command:
    municipality.plot <- ggplot(y, aes(x=as.factor(year), y=seats, fill=party, color=party)) +
      geom_bar(bandwidth=1, stat="identity", group="party", position="fill") +
      labs(x="year", y="% of seats for municipality")
Sample data:
   year district.id                                                         party seats ideology
1  2012         127                  Stranka Pravde I Razvoja Bosne I Hercegovine     1        p
2  2012         127                                Savez Za Bolju Buducnost (SBB)     3        p
3  2008         127                              Stranka Demokratske Akcije (SDA)    13        p
4  2004         127                              Stranka Demokratske Akcije (SDA)    14        p
5  2008         127                          Hrvatska Demokratska Zajednica (HDZ)     1        c
6  2008         127                  Stranka Pravde I Razvoja Bosne I Hercegovine     1        p
7  2012         127                        Stranka Za Bosnu I Hercegovinu (SzBiH)     4        p
8  2000         127                              Socijaldemokratska Partija (SDP)     8        m
9  2012         127                     Narodna Stranka Radom Za Boljitak (NSRzB)     2        m
10 2012         127                            Socijaldemokratska Unija Bih (SDU)     1        p
11 2000         127                                         Koalicija - SDA, SBiH    15        p
12 2008         127                              Socijaldemokratska Partija (SDP)     5        m
13 2008         127                     Narodna Stranka Radom Za Boljitak (NSRzB)     1        m
14 2008         127                                          Koalicija - LDS, SDU     2        m
15 2000         127 Lgk-liberalno-gradanska Koalicija Bih (liberali Bih, Gds Bih)     1        m
16 2000         127                               Nova Hrvatska Inicijativa (NHI)     1        c
17 1997         127                              Socijaldemokratska Partija (SDP)     3        m
18 2012         127                              Socijaldemokratska Partija (SDP)     6        m
19 2004         127                        Stranka Za Bosnu I Hercegovinu (SzBiH)     5        p
20 1997         127                 Bosanskohercegovacka Patriotska Stranka (BPS)     9        p
21 2000         127                 Bosanskohercegovacka Patriotska Stranka (BPS)     3        p
22 2008         127                        Stranka Za Bosnu I Hercegovinu (SzBiH)     4        p
23 1997         127                          Hrvatska Demokratska Zajednica (HDZ)     5        c
24 2000         127                          Hrvatska Demokratska Zajednica (HDZ)     2        c
25 2012         127                              Stranka Demokratske Akcije (SDA)    10        p
26 2004         127                              Socijaldemokratska Partija (SDP)     6        m
27 1997         127                          Koalicija - SDA, SBiH, Liberali, GDS    13        p

