使用R

时间:2016-02-06 18:53:03

标签: r

我试图在三维空间中绘制一个单独的(x,y,z)点,类似于此处的图形: Example 3d graph

我已经尝试使用scatter3d库中的rgl函数,但是我不知道如何获得这一点。我尝试了以下方法:

scatter3d(x=-4, y=0, z=-1)

导致: Result

我不确定如何构建数据以获得重点。是否有另一个我可以使用的库更适合这个?或者我以错误的方式使用此功能?

1 个答案:

答案 0 :(得分:1)

重现你的第一个情节

  public function editphoto($id){
  $data = array(

 "action" => base_url('/index.php/Memberlogincontroller/updatephoto/'.$id), 
            "data" => $this->db->get_where('member',array('id'=>$id))   
    );    

    $this->load->view('member/image', $data);
}

public function upload($id) {
     if ( (int)$id < 1)//$id is not an integer
{
    redirect('memberlogincontroller/member_view', 'refresh');
}
    $this->load->helper(array('form','file','url'));
    $this->load->library('form_validation');
    $config_image = array(
        'upload_path'   => './uploads/',
        'allowed_types' => 'gif|jpg|png',
        'max_size'      => '1024',
        'overwrite'     => true
       // 'max_width'     => '1024',
       // 'max_height'    => '768',

    );

    $this->load->library('upload', $config_image);

      if($this->form_validation->run()==false and empty($_FILES['userfile']['name'][0]))
      {
            $error = array(
                'error_image' => 'Please choose image to upload',
            );
        $this->load->view('member/image', $error);

        }elseif($this->form_validation->run()==true and empty($_FILES['userfile']['name'][0])){
        $error = array(
                'error_image' => 'Please choose image to upload',
        );
        $this->load->view('member/image', $error);
        }elseif($this->form_validation->run()==false and !empty($_FILES['userfile']['name'][0])){
            !$this->upload->data();
             $error = array(
                'error_image' => '',
        );
        $this->load->view('member/image', $error);
        }elseif($this->form_validation->run()==true and !empty($_FILES['userfile']['name'][0])){
             $this->upload->do_upload();
             $data = array('upload_data' => $this->upload->data());
             $this->image->resize($data['upload_data']['full_path'], $data['upload_data']['file_name']);
             $profile = array(
                'image' => $data['upload_data']['file_name']    
        );
        $this->db->update('member',$profile,array('id'=>$id));          
        $this->session->set_userdata($profile); 
        redirect('index.php/memberlogincontroller/getMember/'.$id, 'refresh');       

        }
        } 


    public function image_resize($path,$file){
        $config_resize=array(
        'image_library' => 'gd2',
        'source_image' => $path,
        'maintain_ratio' => TRUE,
        'width'=> 75,
        'height'=>50,
        'new_image'=>'./uploads/thumb/'.$file
        );
        $this->load->library('image_lib',$config_resize);
        $this->image_lib->resize();

    }


    public function updatephoto($id){
    if ((int)$id < 1)//$id is not an integer
{
    redirect('memberlogincontroller/member_view', 'refresh');
}
else{
    $this->load->helper(array('form','file','url'));
    $this->load->library('form_validation');
    $config_image = array(
        'upload_path'   => './uploads/',
        'allowed_types' => 'gif|jpg|png',
        'max_size'      => '1024',
        'overwrite'     => true

       // 'max_width'     => '1024',
       // 'max_height'    => '768',

    );

    $this->load->library('upload', $config_image);

      if($this->form_validation->run()==false and empty($_FILES['userfile']['name'][0]))
        {
            $id = $this->session->userdata('id');
            $memberinfo = array(
                'error_image' => '',
            );
        $this->load->model('MemberloginModel');
        $memberinfo['memberinfo'] = $this->Memberloginmodel->getMember($id);
        $this->load->view('member/image',$memberinfo);


        }
        else
        {
             $this->upload->do_upload();
             $data = array('upload_data' => $this->upload->data());
             $this->image_resize($data['upload_data']['full_path'], $data['upload_data']['file_name']);
             $id = $this->session->userdata('id');
             $this->db->where('id', $id);
             $query = $this->db->get('member'); 
    /*      foreach($query->result() as $row)
        {
            unlink('./uploads/'.$row->image);
            unlink('./uploads/thumb/'.$row->image);
        }        */  
            $data = array(
                'image' => $data['upload_data']['file_name']    
        );
        $this->db->update('member',$data,array('id'=>$id));          
        $this->session->set_userdata($data); 
        redirect('index.php/memberlogincontroller/getMember/'.$id, 'refresh');       
    }
    }
    }

enter image description here