在r中包装传奇

时间:2015-12-05 05:43:33

标签: r

有没有办法包装图例,以便它转到r中的新行或列?甚至试图减小尺寸,但努力工作。

enter image description here

 $criteria = new CDbCriteria;
    $criteria->group = 't.blahah_id'; 
    $result = new CActiveDataProvider('SocialnetworkSpams', array(
        'criteria' => $criteria,
    ));
    echo "<pre>";
    print_r($result->getData());



    Array
(
    [0] => SocialnetworkSpams Object
        (
            [total] => 
            [_new:CActiveRecord:private] => 
            [_attributes:CActiveRecord:private] => Array
                (
                    [id] => 1
                    [created_date] => 2015-12-04 03:50:47
                    [feedtype] => 1
                    [feedback] => 
                    [spam_status] => 1
                    [approveby_id] => 1
                    [blahah_id] => 1
                    [bunit_id] => 3
                    [spamby_id] => 1
                )

            [_related:CActiveRecord:private] => Array
                (
                )

            [_c:CActiveRecord:private] => 
            [_pk:CActiveRecord:private] => 1
            [_alias:CActiveRecord:private] => t
            [_errors:CModel:private] => Array
                (
                )

            [_validators:CModel:private] => 
            [_scenario:CModel:private] => update
            [_e:CComponent:private] => 
            [_m:CComponent:private] => 
        )

    [1] => SocialnetworkSpams Object
        (
            [total] => 
            [_new:CActiveRecord:private] => 
            [_attributes:CActiveRecord:private] => Array
                (
                    [id] => 4
                    [created_date] => 2015-12-04 04:24:07
                    [feedtype] => 5
                    [feedback] => a
                    [spam_status] => 0
                    [approveby_id] => 
                    [blahah_id] => 2
                    [bunit_id] => 3
                    [spamby_id] => 1
                )

            [_related:CActiveRecord:private] => Array
                (
                )

            [_c:CActiveRecord:private] => 
            [_pk:CActiveRecord:private] => 4
            [_alias:CActiveRecord:private] => t
            [_errors:CModel:private] => Array
                (
                )

            [_validators:CModel:private] => 
            [_scenario:CModel:private] => update
            [_e:CComponent:private] => 
            [_m:CComponent:private] => 
        )

)

1 个答案:

答案 0 :(得分:0)

您可以使用guides()并选择最具吸引力的图例行数:

p <- ggplot(cohort.chart.cl, aes(x=month, y=clients, group=cohort))
    p + geom_area(aes(fill = cohort)) +
      scale_fill_manual(values = reds(nrow(cohort.clients))) +
      ggtitle('Customer Cohort') + theme(legend.position="bottom",panel.background=element_rect(fill = "light grey"),legend.text = element_text(size = 7),legend.key.size = unit(0.25, "cm")) +
    guides(fill = guide_legend(nrow = 3))  # or experiment with other numbers of rows